Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Build Eclipse + Maven + Scala-IDEA the Scala Web development environment     - Linux install deploy Ansible (Linux)

- Security matters and practical Linux System (Linux)

- How to monitor Linux system performance Nmon (Linux)

- Hibernate Performance Optimization of reusing SessionFactory (Programming)

- The relationship between UNIX and Linux (Linux)

- Linux into single user mode to modify the administrator password (Linux)

- OpenSUSE / Linux network configuration (Linux)

- The Java ThreadLocal (Programming)

- RHEL6.5 replace local YUM source (Linux)

- Linux NIC configuration (Linux)

- findmnt- Looking mounted file system (Linux)

- Zabbix API and PHP configuration (Server)

- Linux Platform Oracle 11g Single Instance Installation Deployment Configuration Quick Reference (Database)

- Node.js development environment deployment (Server)

- Python Basics: Search Path (Programming)

- MyCAT separate read and write to achieve MySQL Practice (Database)

- Oracle table space is too large processing time (Database)

- Analysis of common mistakes when compiling MySQL installation (Database)

- Fun music library in Linux using command line (Linux)

- KVM installation under CentOS 5.5 (Linux)

 
         
  Build Eclipse + Maven + Scala-IDEA the Scala Web development environment
     
  Add Date : 2017-04-13      
         
       
         
  Rivers and lakes rumors, the best weapon is developed by JetBrains scala God for IntelliJ IDEA, plus the build tool sbt is also.

But due to historical reasons, the project team members become more familiar with Eclipse + Maven combination, in order to achieve rapid prototyping project does not increase the risk of uncertainty brought about a build Eclipse + Maven + Scala-IDE development environment.

The basic principle is that you must fully meet but not limited to the following points:

Reconstruction convenient, easy to debug, supports hot deployment.

You can directly use the existing local and PW maven repository.

Unbound can only use their own familiar language code.

You can quickly mix compiled scala + java code, including a cross-reference files.

If you got a little older, you can download your own Eclipse, then install various plug-ins. However, you may encounter conflicting versions of the plug-dependencies such problems, in order to speed, I downloaded directly official packaged Scala-IDE, there are a variety of platforms to choose from.

Manage projects using Git source code, you need to install EGit plugin, Eclipse plug-in update addresses EGit Updates.

Suppose the project name for the feeling, use JDK 1.7, Servlet 3.0, the final directory structure is as follows.

.
.settings #eclipse project directory
 .classpath #eclipse classpath files
 .project #eclipse project file
src # source code
 main # source code for the main directory
 java #java Code
 scala #scala Code
 resource file resources #
 webapp #web home directory
 WEB-INF # WEB-INF directory
web.xml # web.xml file
 index.jsp # main page
test # test code
java #java test code
scala #scala test code
test resource file resources #
.gitignore #git ignores the configuration
 target # compiler output directory
 Documentation README.md #markdown format
 The pom file pom.xml #maven

pom.xml file

< Project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
  xsi: schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  < ModelVersion> 4.0.0 < / modelVersion>
  < GroupId> feeling < / groupId>
  < ArtifactId> feeling < / artifactId>
  < Version> 0.0.1 < / version>
  < Packaging> war < / packaging>

  < -! < Name> $ {project.artifactId} < / name> ->
  < Name> feeling < / name>
  < Description> our wonderfully feeling application < / description>
  < Url> http://feeling.com < / url>
  < InceptionYear> 2014 < / inceptionYear>

  < Organization>
    < Name> feeling < / name>
    < Url> http://feeling.com < / url>
  < / Organization>

  < Licenses>
    < License>
      < Name> The Apache Software License, Version 2.0 < / name>
      < Url> http://www.apache.org/licenses/LICENSE-2.0.txt < / url>
      < Distribution> repo < / distribution>
    < / License>
  < / Licenses>

  < Developers>
    < Developer>
      < Id> bruce < / id>
      < Name> bruce sha < / name>
      < Url> http://bruce-sha.github.io < / url>
      < Email> bu.ru@qq.com < / email>
    < / Developer>
  < / Developers>

  < Scm>
   < Connection> http://17.20.13.23/scm/git/feeling < / connection>
   < DeveloperConnection> http://17.20.13.23/scm/git/feeling < / developerConnection>
   < Url> http://17.20.13.23 < / url>
  < / Scm>

  < Properties>
    < Scala.version> 2.10.3 < /scala.version>
    < Maven.compiler.source> 1.7 < /maven.compiler.source>
    < Maven.compiler.target> 1.7 < /maven.compiler.target>
    < Encoding> UTF-8 < / encoding>
  < / Properties>

  < ! - Personalized Development ->
  < Profiles>
    < Profile>
      < Id> dev < / id>
      < Activation>
        < ActiveByDefault> true < / activeByDefault>
      < / Activation>
      < Properties>
        < Build.param> this is dev < /build.param>
      < / Properties>
    < / Profile>
    < Profile>
      < Id> release < / id>
      < Activation>
        < ActiveByDefault> false < / activeByDefault>
      < / Activation>
      < Properties>
        < Build.param> this is relase < /build.param>
      < / Properties>
    < / Profile>
  < / Profiles>

  < Dependencies>

    < -! Google ->
    < Dependency>
      < GroupId> com.google.guava < / groupId>
      < ArtifactId> guava < / artifactId>
      < Version> 15.0 < / version>
    < / Dependency>
    < Dependency>
      < GroupId> com.google.inject < / groupId>
      < ArtifactId> guice < / artifactId>
      < Version> 3.0 < / version>
    < / Dependency>

    < -! Servlet ->
    < Dependency>
      < GroupId> javax.servlet < / groupId>
      < ArtifactId> javax.servlet-api < / artifactId>
      < -! < Version> 2.5 < / version> ->
      < Version> 3.0.1 < / version>
      < Scope> provided < / scope>
    < / Dependency>

    < -! < Dependency> ->
    < -! < GroupId> javax.servlet < / groupId> ->
    < -! < ArtifactId> jsp-api < / artifactId> ->
    < -! < Version> 2.0 < / version> ->
    < -! < Scope> provided < / scope> ->
    < -! < / Dependency> ->

    < -! Scala ->
    < Dependency>
      < GroupId> org.scala-lang < / groupId>
      < ArtifactId> scala-library < / artifactId>
      < Version> $ {scala.version} < / version>
    < / Dependency>

    < -! Test ->
    < Dependency>
      < GroupId> junit < / groupId>
      < ArtifactId> junit < / artifactId>
      < Version> 4.11 < / version>
      < Scope> test < / scope>
    < / Dependency>

    < ! - Other packages not going to describe ->
    < -! Log ->
    < -! Json ->
    < -! Mongodb ->
    < -! Quartz ->

  < / Dependencies>

  < Build>
    < FinalName> feeling < / finalName>

    < ! - Must, resource file placeholder is replaced with the key profile configuration ->
    < Resources>
      < Resource>
        < Directory> src / main / resources < / directory>
        < Includes>
          < Include> *. * < / Include>
        < / Includes>
        < Filtering> true < / filtering>
      < / Resource>
    < / Resources>

    < ! - Must kill, or do not compile the code src / main / java under ->
    < -! < SourceDirectory> src / main / scala < / sourceDirectory> ->
    < -! < TestSourceDirectory> src / test / scala < / testSourceDirectory> ->
    < Plugins>
      < Plugin>
        < -! See http://davidb.github.com/scala-maven-plugin ->
        < GroupId> net.alchim31.maven < / groupId>
        < ArtifactId> scala-maven-plugin < / artifactId>
        < Version> 3.1.6 < / version>
        < ! - Must, otherwise you can not mix compilation Cross Reference File ->
        < Executions>
          < Execution>
            < Id> scala-compile-first < / id>
            < Phase> process-resources < / phase>
            < Goals>
              < Goal> add-source < / goal>
              < Goal> compile < / goal>
            < / Goals>
          < / Execution>
          < Execution>
            < Id> scala-test-compile < / id>
            < Phase> process-test-resources < / phase>
            < Goals>
              < Goal> testCompile < / goal>
            < / Goals>
          < / Execution>
        < / Executions>
      < / Plugin>
      < Plugin>
        < GroupId> org.apache.maven.plugins < / groupId>
        < ArtifactId> maven-surefire-plugin < / artifactId>
        < Version> 2.13 < / version>
        < Configuration>
          < UseFile> false < / useFile>
          < DisableXmlReport> true < / disableXmlReport>
          < -! If you have classpath issue like NoDefClassError, ... ->
          < -! UseManifestOnlyJar> false < / useManifestOnlyJar ->
          < Includes>
            < Include> ** / * Test. * < / Include>
            < Include> ** / * Suite. * < / Include>
          < / Includes>
        < / Configuration>
      < / Plugin>
      < Plugin>
        < GroupId> org.apache.maven.plugins < / groupId>
        < ArtifactId> maven-war-plugin < / artifactId>
        < Version> 2.4 < / version>
        < Configuration>
          < ! - Remove web.xml dependence, Servlet 3.0 web.xml file can not ->
          < FailOnMissingWebXml> false < / failOnMissingWebXml>
        < / Configuration>
      < / Plugin>

      < -! Jetty6, does not support servlet3 ->
      < -! < Plugin> ->
      < -! < GroupId> org.mortbay.jetty < / groupId> ->
      < -! < ArtifactId> maven-jetty-plugin < / artifactId> ->
      < -! < Version> 6.1.26 < / version> ->
      < -! < Configuration> ->
      < -! < ScanIntervalSeconds> 10 < / scanIntervalSeconds> ->
      < -! < StopKey> foo < / stopKey> ->
      < -! < StopPort> 9999 < / stopPort> ->
      < -! < / Configuration> ->
      < -! < Executions> ->
      < -! < Execution> ->
      < -! < Id> start-jetty < / id> ->
      < -! < Phase> pre-integration-test < / phase> ->
      < -! < Goals> ->
      < -! < Goal> run < / goal> ->
      < -! < / Goals> ->
      < -! < Configuration> ->
      < -! < ScanIntervalSeconds> 0 < / scanIntervalSeconds> ->
      < -! < Daemon> true < / daemon> ->
      < -! < / Configuration> ->
      < -! < / Execution> ->
      < -! < Execution> ->
      < -! < Id> stop-jetty < / id> ->
      < -! < Phase> post-integration-test < / phase> ->
      < -! < Goals> ->
      < -! < Goal> stop < / goal> ->
      < -! < / Goals> ->
      < -! < / Execution> ->
      < -! < / Executions> ->
      < -! < / Plugin> ->

      < - Tomcat7:! Run Note tomcat: run run is 6, does not support servlet3 ->
      < Plugin>
        < -! Http://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-plugin ->
        < GroupId> org.apache.tomcat.maven < / groupId>
        < ArtifactId> tomcat7-maven-plugin < / artifactId>
        < Version> 2.2 < / version>
        < Configuration>
          < Path> / < / path>
          < Port> 80 < / port>
        < / Configuration>
      < / Plugin>

      < - Jetty:! Run ->
      < Plugin>
        < -! Http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin ->
        < GroupId> org.mortbay.jetty < / groupId>
        < -! < ArtifactId> maven-jetty-plugin < / artifactId> This is jetty6 not support servlet3 ->
        < ArtifactId> jetty-maven-plugin < / artifactId>
        < Version> 8.1.13.v20130916 < / version>
        < Configuration>
          < StopPort> 9966 < / stopPort>
          < StopKey> foo < / stopKey>
          < ScanIntervalSeconds> 0 < / scanIntervalSeconds>
          < Connectors>
            < Connector implementation = "org.eclipse.jetty.server.nio.SelectChannelConnector">
              < Port> 80 < / port>
              < MaxIdleTime> 60000 < / maxIdleTime>
            < / Connector>
          < / Connectors>
          < WebAppConfig>
            < ContextPath> / < / contextPath>
          < / WebAppConfig>
        < / Configuration>
      < / Plugin>

    < / Plugins>
  < / Build>
< / Project>

web.xml

< ? Xml version = "1.0" encoding = "UTF-8"?>
< -! < Web-app ->
< -! Xmlns = "http://java.sun.com/xml/ns/javaee" ->
< - Xmlns:! Xsi = "http://www.w3.org/2001/XMLSchema-instance" ->
< - Xsi:! SchemaLocation = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" ->
< -! Version = "2.5" ->
< ! -> ->
< Web-app xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
  xmlns = "http://java.sun.com/xml/ns/javaee"
  xsi: schemaLocation = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  id = "WebApp_ID" version = "3.0">

  < Display-name> feeling < / display-name>

  < -! < Servlet> ->
  < -! < Servlet-name> feeling < / servlet-name> ->
  < -! < Servlet-class> feelings.service.FeelingService < / servlet-class> ->
  < -! < / Servlet> ->

  < -! < Servlet-mapping> ->
  < -! < Servlet-name> feeling < / servlet-name> ->
  < -! < Url-pattern> / feeling < / url-pattern> ->
  < -! < / Servlet-mapping> ->
  
  < Welcome-file-list>
    < Welcome-file> index.html < / welcome-file>
    < Welcome-file> index.htm < / welcome-file>
    < Welcome-file> index.jsp < / welcome-file>
    < Welcome-file> default.html < / welcome-file>
    < Welcome-file> default.htm < / welcome-file>
    < Welcome-file> default.jsp < / welcome-file>
  < / Welcome-file-list>
  
< / Web-app>

.project file:

< ? Xml version = "1.0" encoding = "UTF-8"?>
< ProjectDescription>
  < Name> feeling < / name>
  < Comment> < / comment>
  < Projects>
  < / Projects>
  < BuildSpec>
    < BuildCommand>
      < Name> org.scala-ide.sdt.core.scalabuilder < / name>
      < Arguments>
      < / Arguments>
    < / BuildCommand>
    < BuildCommand>
      < Name> org.eclipse.m2e.core.maven2Builder < / name>
      < Arguments>
      < / Arguments>
    < / BuildCommand>
  < / BuildSpec>
  < Natures>
    < Nature> org.scala-ide.sdt.core.scalanature < / nature>
    < Nature> org.eclipse.jdt.core.javanature < / nature>
    < Nature> org.eclipse.m2e.core.maven2Nature < / nature>
  < / Natures>
< / ProjectDescription>

.classpath file:

< ? Xml version = "1.0" encoding = "UTF-8"?>
< Classpath>
  < Classpathentry kind = "src" output = "target / classes" path = "src / main / java">
    < Attributes>
      < Attribute name = "optional" value = "true" />
      < Attribute name = "maven.pomderived" value = "true" />
    < / Attributes>
  < / Classpathentry>
  < Classpathentry kind = "src" output = "target / classes" path = "src / main / scala">
    < Attributes>
      < Attribute name = "optional" value = "true" />
      < Attribute name = "maven.pomderived" value = "true" />
    < / Attributes>
  < / Classpathentry>
  < Classpathentry including = "** / *. Java" kind = "src" path = "src / main / resources" />
  < Classpathentry kind = "src" output = "target / test-classes" path = "src / test / java">
    < Attributes>
      < Attribute name = "optional" value = "true" />
      < Attribute name = "maven.pomderived" value = "true" />
    < / Attributes>
  < / Classpathentry>
  < Classpathentry kind = "src" output = "target / test-classes" path = "src / test / scala">
    < Attributes>
      < Attribute name = "optional" value = "true" />
      < Attribute name = "maven.pomderived" value = "true" />
    < / Attributes>
  < / Classpathentry>
  < Classpathentry including = "** / *. Java" kind = "src" path = "src / test / resources" />
  < Classpathentry kind = "con" path = "org.scala-ide.sdt.launching.SCALA_CONTAINER" />
  < Classpathentry kind = "con" path = "org.eclipse.jdt.launching.JRE_CONTAINER / org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType / JavaSE-1.7">
    < Attributes>
      < Attribute name = "maven.pomderived" value = "true" />
    < / Attributes>
  < / Classpathentry>
  < Classpathentry kind = "con" path = "org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
    < Attributes>
      < Attribute name = "maven.pomderived" value = "true" />
    < / Attributes>
  < / Classpathentry>
  < Classpathentry kind = "output" path = "target / classes" />
< / Classpath>
     
         
       
         
  More:      
 
- About Linux iptables firewall interview questions and answers (Linux)
- MySQL migration tool used in the production environment (Database)
- Red Hat Enterprise Linux 6.4 Configuring VNC Remote Desktop login access (Linux)
- Logging information through the web GUI (LogAnalyzer) (Server)
- PHP call a Python program (Programming)
- Linux, set and view environment variables (Linux)
- Use SecureCRT to transfer files between Linux and Windows (Linux)
- GRUB and Linux system repair (Linux)
- NAT (network address translation) Realization (Linux)
- VNC connection VMware vSphere ESXi 5.5 (Linux)
- Nginx high concurrency optimization ideas (Server)
- Linux awk text analysis tool (Linux)
- Open container cluster management system architecture and components introduced Kubernetes (Server)
- CentOS 6.5 boot automatically mount the hard drive (Linux)
- Setting Hibernate connection MySQL database connection pool coding (Database)
- Use eCryptFS encrypt files and directories on Linux (Linux)
- RHEL5 multipath configuration (Linux)
- Fun music library in Linux using command line (Linux)
- Security experience: to see how the experts deal with DDoS attacks (Linux)
- MySQL5.7 JSON type using presentation (Database)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.