Friday, December 19, 2014

Maven: Parent POMs, Modules and the Maven Reactor

Given this POM

 <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>swtk-eng</groupId>  
      <artifactId>swtk-eng</artifactId>  
      <version>1.0.0</version>  
      <packaging>pom</packaging>  
   
      <url>https://github.com/torrances/swtk-eng</url>  
      <description>an English Parsing Toolkit for the Semantic Web</description>  
      <inceptionYear>2014</inceptionYear>  
   
      <modules>  
           <module>../eng-wordnet</module>  
           <module>../eng-tokenizer</module>  
           <module>../eng-snowball</module>  
           <module>../eng-stanford</module>  
           <module>../consumer</module>  
      </modules>  
   
      <properties>  
   
           <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
           <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>  
   
           <!-- Internal Versions -->  
           <swtk-commons.version>1.0.0</swtk-commons.version>  
           <eng-wordnet.version>1.0.0</eng-wordnet.version>  
           <eng-snowball.version>1.0.0</eng-snowball.version>  
           <eng-stanford.version>1.0.0</eng-stanford.version>  
           <eng-tokenizer.version>1.0.0</eng-tokenizer.version>  
   
           <!-- External Versions (Stanford) -->  
           <corenlp.version>3.4</corenlp.version>  
           <corenlp-models.version>3.4.1</corenlp-models.version>  
   
           <!-- External Versions -->  
           <jaws.version>1.2</jaws.version>  
           <junit.version>4.12-beta-1</junit.version>  
           <log4j.version>1.2.17</log4j.version>  
           <commons-io.version>2.4</commons-io.version>  
           <commons-lang.version>3.3.2</commons-lang.version>  
           <gson.version>2.3</gson.version>  
   
      </properties>  
   
      <dependencies>  
   
           <!-- Internal Dependencies -->  
           <dependency>  
                <groupId>swtk-commons</groupId>  
                <artifactId>swtk-commons</artifactId>  
                <version>${swtk-commons.version}</version>  
                <type>pom</type>  
           </dependency>  
           <dependency>  
                <groupId>org.swtk.eng.tokenizer</groupId>  
                <artifactId>eng-tokenizer</artifactId>  
                <version>${eng-tokenizer.version}</version>  
           </dependency>  
           <dependency>  
                <groupId>org.swtk.eng.stanford</groupId>  
                <artifactId>eng-stanford</artifactId>  
                <version>${eng-stanford.version}</version>  
           </dependency>  
           <dependency>  
                <groupId>org.swtk.eng.wordnet</groupId>  
                <artifactId>eng-wordnet</artifactId>  
                <version>${eng-wordnet.version}</version>  
           </dependency>  
           <dependency>  
                <groupId>org.swtk.eng.snowball</groupId>  
                <artifactId>eng-snowball</artifactId>  
                <version>${eng-snowball.version}</version>  
           </dependency>  
   
      </dependencies>  
   
 </project>  

Notice the modules section highlighted in blue toward the top of the file.

This gives an ordering to Maven for the building of a workspace.

This is helpful for Jenkins too.

An output of the command
mvn clean install
looks like this:
 [INFO] Scanning for projects...  
 [INFO] ------------------------------------------------------------------------  
 [INFO] Reactor Build Order:  
 [INFO]   
 [INFO] Wordnet Project  
 [INFO] Tokenizer  
 [INFO] Snowball Stemmer  
 [INFO] Stanford CoreNLP  
 [INFO] swtk-eng  
 [INFO] swtk-eng-web  
 [INFO]                                       
 [INFO] ------------------------------------------------------------------------  
 [INFO] Building Wordnet Project 1.0.0  
 [INFO] ------------------------------------------------------------------------  
 [INFO]   
 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ eng-wordnet ---  
 [INFO] Deleting /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-wordnet/target  
 [INFO]   
 [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ eng-wordnet ---  
 [INFO] Using 'UTF-8' encoding to copy filtered resources.  
 [INFO] Copying 27 resources  
 [INFO]   
 [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ eng-wordnet ---  
 [INFO] Changes detected - recompiling the module!  
 [INFO] Compiling 10 source files to /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-wordnet/target/classes  
 [INFO]   
 [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ eng-wordnet ---  
 [INFO] Using 'UTF-8' encoding to copy filtered resources.  
 [INFO] skip non existing resourceDirectory /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-wordnet/src/test/resources  
 [INFO]   
 [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ eng-wordnet ---  
 [INFO] Changes detected - recompiling the module!  
 [INFO] Compiling 2 source files to /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-wordnet/target/test-classes  
 [INFO]   
 [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ eng-wordnet ---  
 [INFO] Surefire report directory: /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-wordnet/target/surefire-reports  
   
 -------------------------------------------------------  
  T E S T S  
 -------------------------------------------------------  
 Running org.swtk.eng.wordnet.WordnetNounsDictionaryTest  
 ClassPathXmlApplicationContext:510 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@206b4c9c: startup date [Fri Dec 19 15:42:37 PST 2014]; root of context hierarchy  
 XmlBeanDefinitionReader:317 - Loading XML bean definitions from class path resource [config/application-context.xml]  
 PropertySourcesPlaceholderConfigurer:172 - Loading properties file from class path resource [config/wordnet.paths.properties]  
 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.826 sec  
 Running org.swtk.eng.wordnet.WordnetServiceTest  
 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.068 sec  
   
 Results :  
   
 Tests run: 2, Failures: 0, Errors: 0, Skipped: 0  
   
 [INFO]   
 [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ eng-wordnet ---  
 [INFO] Building jar: /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-wordnet/target/eng-wordnet-1.0.0.jar  
 [INFO]   
 [INFO] --- maven-install-plugin:2.4:install (default-install) @ eng-wordnet ---  
 [INFO] Installing /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-wordnet/target/eng-wordnet-1.0.0.jar to /home/craig/.m2/repository/org/swtk/eng/wordnet/eng-wordnet/1.0.0/eng-wordnet-1.0.0.jar  
 [INFO] Installing /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-wordnet/pom.xml to /home/craig/.m2/repository/org/swtk/eng/wordnet/eng-wordnet/1.0.0/eng-wordnet-1.0.0.pom  
 [INFO]                                       
 [INFO] ------------------------------------------------------------------------  
 [INFO] Building Tokenizer 1.0.0  
 [INFO] ------------------------------------------------------------------------  
 [INFO]   
 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ eng-tokenizer ---  
 [INFO] Deleting /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-tokenizer/target  
 [INFO]   
 [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ eng-tokenizer ---  
 [INFO] Using 'UTF-8' encoding to copy filtered resources.  
 [INFO] skip non existing resourceDirectory /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-tokenizer/src/main/resources  
 [INFO]   
 [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ eng-tokenizer ---  
 [INFO] Changes detected - recompiling the module!  
 [INFO] Compiling 12 source files to /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-tokenizer/target/classes  
 [INFO]   
 [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ eng-tokenizer ---  
 [INFO] Using 'UTF-8' encoding to copy filtered resources.  
 [INFO] Copying 7 resources  
 [INFO]   
 [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ eng-tokenizer ---  
 [INFO] Changes detected - recompiling the module!  
 [INFO] Compiling 3 source files to /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-tokenizer/target/test-classes  
 [INFO]   
 [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ eng-tokenizer ---  
 [INFO] Surefire report directory: /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-tokenizer/target/surefire-reports  
   
 -------------------------------------------------------  
  T E S T S  
 -------------------------------------------------------  
 Running org.swtk.eng.tokenizer.text.TextTokenizerTest  
 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.137 sec  
   
 Results :  
   
 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0  
   
 [INFO]   
 [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ eng-tokenizer ---  
 [INFO] Building jar: /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-tokenizer/target/eng-tokenizer-1.0.0.jar  
 [INFO]   
 [INFO] --- maven-install-plugin:2.4:install (default-install) @ eng-tokenizer ---  
 [INFO] Installing /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-tokenizer/target/eng-tokenizer-1.0.0.jar to /home/craig/.m2/repository/org/swtk/eng/tokenizer/eng-tokenizer/1.0.0/eng-tokenizer-1.0.0.jar  
 [INFO] Installing /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-tokenizer/pom.xml to /home/craig/.m2/repository/org/swtk/eng/tokenizer/eng-tokenizer/1.0.0/eng-tokenizer-1.0.0.pom  
 [INFO]                                       
 [INFO] ------------------------------------------------------------------------  
 [INFO] Building Snowball Stemmer 1.0.0  
 [INFO] ------------------------------------------------------------------------  
 [INFO]   
 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ eng-snowball ---  
 [INFO] Deleting /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-snowball/target  
 [INFO]   
 [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ eng-snowball ---  
 [INFO] Using 'UTF-8' encoding to copy filtered resources.  
 [INFO] skip non existing resourceDirectory /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-snowball/src/main/resources  
 [INFO]   
 [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ eng-snowball ---  
 [INFO] Changes detected - recompiling the module!  
 [INFO] Compiling 7 source files to /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-snowball/target/classes  
 [INFO]   
 [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ eng-snowball ---  
 [INFO] Using 'UTF-8' encoding to copy filtered resources.  
 [INFO] skip non existing resourceDirectory /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-snowball/src/test/resources  
 [INFO]   
 [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ eng-snowball ---  
 [INFO] Changes detected - recompiling the module!  
 [INFO] Compiling 1 source file to /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-snowball/target/test-classes  
 [INFO]   
 [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ eng-snowball ---  
 [INFO] Surefire report directory: /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-snowball/target/surefire-reports  
   
 -------------------------------------------------------  
  T E S T S  
 -------------------------------------------------------  
 Running org.swtk.eng.snowball.StemmerTest  
 Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.075 sec  
   
 Results :  
   
 Tests run: 3, Failures: 0, Errors: 0, Skipped: 0  
   
 [INFO]   
 [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ eng-snowball ---  
 [INFO] Building jar: /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-snowball/target/eng-snowball-1.0.0.jar  
 [INFO]   
 [INFO] --- maven-install-plugin:2.4:install (default-install) @ eng-snowball ---  
 [INFO] Installing /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-snowball/target/eng-snowball-1.0.0.jar to /home/craig/.m2/repository/org/swtk/eng/snowball/eng-snowball/1.0.0/eng-snowball-1.0.0.jar  
 [INFO] Installing /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-snowball/pom.xml to /home/craig/.m2/repository/org/swtk/eng/snowball/eng-snowball/1.0.0/eng-snowball-1.0.0.pom  
 [INFO]                                       
 [INFO] ------------------------------------------------------------------------  
 [INFO] Building Stanford CoreNLP 1.0.0  
 [INFO] ------------------------------------------------------------------------  
 [INFO]   
 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ eng-stanford ---  
 [INFO] Deleting /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-stanford/target  
 [INFO]   
 [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ eng-stanford ---  
 [INFO] Using 'UTF-8' encoding to copy filtered resources.  
 [INFO] skip non existing resourceDirectory /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-stanford/src/main/resources  
 [INFO]   
 [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ eng-stanford ---  
 [INFO] Changes detected - recompiling the module!  
 [INFO] Compiling 46 source files to /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-stanford/target/classes  
 [INFO]   
 [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ eng-stanford ---  
 [INFO] Using 'UTF-8' encoding to copy filtered resources.  
 [INFO] Copying 1 resource  
 [INFO]   
 [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ eng-stanford ---  
 [INFO] Changes detected - recompiling the module!  
 [INFO] Compiling 7 source files to /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-stanford/target/test-classes  
 [INFO]   
 [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ eng-stanford ---  
 [INFO] Surefire report directory: /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-stanford/target/surefire-reports  
   
 -------------------------------------------------------  
  T E S T S  
 -------------------------------------------------------  
 Running org.swtk.eng.stanford.impl.DependencyParseTest  
 Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.45 sec  
 Running org.swtk.eng.stanford.impl.DeepParseFactoryTest  
 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec  
 Running org.swtk.eng.stanford.impl.DeepParseTest  
 Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.094 sec  
 Running org.swtk.eng.stanford.impl.CombineNounPhrasesTest  
 Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.313 sec  
 Running org.swtk.eng.stanford.impl.CreateStructuredDomTest  
 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.086 sec  
 Running org.swtk.eng.stanford.impl.DependencyParseFileTest  
 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.231 sec  
   
 Results :  
   
 Tests run: 18, Failures: 0, Errors: 0, Skipped: 0  
   
 [INFO]   
 [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ eng-stanford ---  
 [INFO] Building jar: /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-stanford/target/eng-stanford-1.0.0.jar  
 [INFO]   
 [INFO] --- maven-install-plugin:2.4:install (default-install) @ eng-stanford ---  
 [INFO] Installing /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-stanford/target/eng-stanford-1.0.0.jar to /home/craig/.m2/repository/org/swtk/eng/stanford/eng-stanford/1.0.0/eng-stanford-1.0.0.jar  
 [INFO] Installing /home/craig/workspaces/swtk/eng/projects/swtk-eng/eng-stanford/pom.xml to /home/craig/.m2/repository/org/swtk/eng/stanford/eng-stanford/1.0.0/eng-stanford-1.0.0.pom  
 [INFO]                                       
 [INFO] ------------------------------------------------------------------------  
 [INFO] Building swtk-eng 1.0.0  
 [INFO] ------------------------------------------------------------------------  
 [INFO]   
 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ swtk-eng ---  
 [INFO]   
 [INFO] --- maven-install-plugin:2.4:install (default-install) @ swtk-eng ---  
 [INFO] Installing /home/craig/workspaces/swtk/eng/projects/swtk-eng/build/pom.xml to /home/craig/.m2/repository/swtk-eng/swtk-eng/1.0.0/swtk-eng-1.0.0.pom  
 [INFO]                                       
 [INFO] ------------------------------------------------------------------------  
 [INFO] Building swtk-eng-web 1.0.0  
 [INFO] ------------------------------------------------------------------------  
 [INFO]   
 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ swtk-eng-web ---  
 [INFO] Deleting /home/craig/workspaces/swtk/eng/projects/swtk-eng/consumer/target  
 [INFO]   
 [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ swtk-eng-web ---  
 [INFO] Using 'UTF-8' encoding to copy filtered resources.  
 [INFO] skip non existing resourceDirectory /home/craig/workspaces/swtk/eng/projects/swtk-eng/consumer/src/main/resources  
 [INFO]   
 [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ swtk-eng-web ---  
 [INFO] Changes detected - recompiling the module!  
 [INFO] Compiling 20 source files to /home/craig/workspaces/swtk/eng/projects/swtk-eng/consumer/target/classes  
 [INFO]   
 [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ swtk-eng-web ---  
 [INFO] Using 'UTF-8' encoding to copy filtered resources.  
 [INFO] skip non existing resourceDirectory /home/craig/workspaces/swtk/eng/projects/swtk-eng/consumer/src/test/resources  
 [INFO]   
 [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ swtk-eng-web ---  
 [INFO] Changes detected - recompiling the module!  
 [INFO] Compiling 1 source file to /home/craig/workspaces/swtk/eng/projects/swtk-eng/consumer/target/test-classes  
 [INFO]   
 [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ swtk-eng-web ---  
 [INFO] Surefire report directory: /home/craig/workspaces/swtk/eng/projects/swtk-eng/consumer/target/surefire-reports  
   
 -------------------------------------------------------  
  T E S T S  
 -------------------------------------------------------  
 Running org.swtk.eng.consumer.NodeLinksAdapterTest  
 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.381 sec  
   
 Results :  
   
 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0  
   
 [INFO]   
 [INFO] --- maven-war-plugin:2.4:war (default-war) @ swtk-eng-web ---  
 [INFO] Packaging webapp  
 [INFO] Assembling webapp [swtk-eng-web] in [/home/craig/workspaces/swtk/eng/projects/swtk-eng/consumer/target/swtk-eng-web-1.0.0]  
 [INFO] Processing war project  
 [INFO] Copying webapp resources [/home/craig/workspaces/swtk/eng/projects/swtk-eng/consumer/WebContent]  
 [INFO] Webapp assembled in [287 msecs]  
 [INFO] Building war: /home/craig/workspaces/swtk/eng/projects/swtk-eng/consumer/target/swtk-eng-web-1.0.0.war  
 [INFO]   
 [INFO] --- maven-install-plugin:2.4:install (default-install) @ swtk-eng-web ---  
 [INFO] Installing /home/craig/workspaces/swtk/eng/projects/swtk-eng/consumer/target/swtk-eng-web-1.0.0.war to /home/craig/.m2/repository/swtk-eng-web/swtk-eng-web/1.0.0/swtk-eng-web-1.0.0.war  
 [INFO] Installing /home/craig/workspaces/swtk/eng/projects/swtk-eng/consumer/pom.xml to /home/craig/.m2/repository/swtk-eng-web/swtk-eng-web/1.0.0/swtk-eng-web-1.0.0.pom  
 [INFO] ------------------------------------------------------------------------  
 [INFO] Reactor Summary:  
 [INFO]   
 [INFO] Wordnet Project .................................... SUCCESS [ 5.786 s]  
 [INFO] Tokenizer .......................................... SUCCESS [ 0.758 s]  
 [INFO] Snowball Stemmer ................................... SUCCESS [ 0.698 s]  
 [INFO] Stanford CoreNLP ................................... SUCCESS [ 5.245 s]  
 [INFO] swtk-eng ........................................... SUCCESS [ 0.004 s]  
 [INFO] swtk-eng-web ....................................... SUCCESS [ 37.152 s]  
 [INFO] ------------------------------------------------------------------------  
 [INFO] BUILD SUCCESS  
 [INFO] ------------------------------------------------------------------------  
 [INFO] Total time: 49.805 s  
 [INFO] Finished at: 2014-12-19T15:43:24-08:00  
 [INFO] Final Memory: 21M/247M  
 [INFO] ------------------------------------------------------------------------  

Notice the Reactor Summary output in blue at the bottom. This gives the build order of the project.

No comments:

Post a Comment