Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Build Eclipse + Maven + Scala-IDEA the Scala Web development environment     - Install Mac OS X 10.9 systems VMware10 (Linux)

- Install Xshell on Mac OS X (Linux)

- AIX system file security aspects (Linux)

- Bootstrap 3.3.5 release download, Web front-end UI framework (Linux)

- Linux environment variable configuration and save places (Linux)

- RedHat Redis Linux installation (Database)

- Macro Analysis Performance: PHP Performance Analysis and Experiment (Programming)

- Linux command line under HTTP traffic sniffing tool: httpry (Linux)

- Summary Linux operating system some tips to prevent attacks (Linux)

- Under CentOS Linux automatic backup MySQL database daily (Database)

- Ubuntu install ruby (Linux)

- How to upgrade to Oracle 11g Oracle 12c (Database)

- To control based on IP address routing policy under Linux (Linux)

- Troubleshooting Linux virtual machine device id and the letter of inconsistencies (Linux)

- Ubuntu 14.04 jdk Installation and Configuration (Linux)

- Bubble Sort Algorithms (Programming)

- Change CentOS 7 NIC name eno16777736 to eth0 (Linux)

- Introduction and bash history command to quickly call (Linux)

- Java inner classes (Programming)

- Browser caching mechanism on the analysis (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:      
 
- Binary tree and some basic operations with binary list (Programming)
- Install Apache streaming media services on CentOS 6.4 (Server)
- Struts2 form of non-use component tags (Programming)
- Ten best plug surge Emacs Productivity (Linux)
- OpenSUSE / Linux network configuration (Linux)
- Spring Integration ehcache annotation implement the query cache and cache update or delete instant (Programming)
- PHP with FastCGI and mod_php Comments (Server)
- VMware Workstation + Ubuntu 10.04 Download the Android 2.2 source code (Linux)
- Under CentOS Linux automatic backup MySQL database daily (Database)
- Ten SCP transfer command example (Linux)
- Linux security configuration (Linux)
- To update Python version under CentOS system (Linux)
- Linux SU command security Suggestions (Linux)
- Configuring Sublime Text Python runtime environment 2 (Linux)
- JavaScript in this usage (Programming)
- pga_aggregate_target and _pga_max_size can not use absolute limit actual PGA (Database)
- Linux suffered SYN flood attack setting (Linux)
- MongoDB, Cassandra, HBase transaction design strategy (Database)
- Elasticsearch 2.20 Highlight (Server)
- cursor_sharing induced error ORA-00600 (Database)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.