zoukankan      html  css  js  c++  java
  • Maven

    创建项目

    xxx - 继承自testDep.PPP

    <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/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    
    	<groupId>testDep.XXX</groupId>
    	<artifactId>xxx</artifactId>
    	<packaging>jar</packaging>
    
    	<name>xxx</name>
    	<url>http://maven.apache.org</url>
    
    	<properties>
    		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    	</properties>
    	
    	<parent>
    		<groupId>testDep.PPP</groupId>
    		<artifactId>ppp</artifactId>
    		<version>0.0.1-SNAPSHOT</version>
    	</parent>
    
    	<dependencies>
    		<dependency>
    			<groupId>junit</groupId>
    			<artifactId>junit</artifactId>
    		</dependency>
    	</dependencies>
    </project>
    
    

    yyy - 继承自testDep.PPP

    <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/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    
    	<groupId>testDep.YYY</groupId>
    	<artifactId>yyy</artifactId>
    	<packaging>jar</packaging>
    
    	<name>yyy</name>
    	<url>http://maven.apache.org</url>
    
    	<properties>
    		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    	</properties>
    
    	<parent>
    		<groupId>testDep.PPP</groupId>
    		<artifactId>ppp</artifactId>
    		<version>0.0.1-SNAPSHOT</version>
    	</parent>
    
    	<dependencies>
    		<dependency>
    			<groupId>junit</groupId>
    			<artifactId>junit</artifactId>
    		</dependency>
    	</dependencies>
    </project>
    

    zzz - 在zzz中聚合xxx和yyy

    <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/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
    
      <groupId>testDep.ZZZ</groupId>
      <artifactId>zzz</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>pom</packaging>
    
      <name>zzz</name>
      <url>http://maven.apache.org</url>
    
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>
    
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <modules>
        <module>../xxx</module>
        <module>../yyy</module>    
      </modules>  
    </project>
    
    

    ppp - 父项目

    <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/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    
    	<groupId>testDep.PPP</groupId>
    	<artifactId>ppp</artifactId>
    	<version>0.0.1-SNAPSHOT</version>
    	<packaging>pom</packaging>
    
    	<name>ppp</name>
    	<url>http://maven.apache.org</url>
    
    	<properties>
    		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    		<junit.version>3.8.1</junit.version>
    	</properties>
    	<dependencyManagement>
    		<dependencies>
    			<dependency>
    				<groupId>junit</groupId>
    				<artifactId>junit</artifactId>
    				<version>${junit.version}</version>
    				<scope>test</scope>
    			</dependency>
    		</dependencies>
    	</dependencyManagement>
    </project>
    

    验证

    ppp执行clean install

    [INFO] Scanning for projects...
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] Building ppp 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ppp ---
    [INFO] Deleting D:Anliven-RunningenEclipseProjectsppp	arget
    [INFO] 
    [INFO] --- maven-install-plugin:2.4:install (default-install) @ ppp ---
    [INFO] Installing D:Anliven-RunningenEclipseProjectsppppom.xml to D:DownLoadFilesapache-maven-repo	estDepPPPppp.0.1-SNAPSHOTppp-0.0.1-SNAPSHOT.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.578 s
    [INFO] Finished at: 2017-10-24T16:43:09+08:00
    [INFO] Final Memory: 9M/309M
    [INFO] ------------------------------------------------------------------------
    
    

    xxx执行clean install

    [INFO] Scanning for projects...
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] Building xxx 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ xxx ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory D:Anliven-RunningenEclipseProjectsxxxsrcmain
    esources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ xxx ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ xxx ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory D:Anliven-RunningenEclipseProjectsxxxsrc	est
    esources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ xxx ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ xxx ---
    [INFO] Surefire report directory: D:Anliven-RunningenEclipseProjectsxxx	argetsurefire-reports
    
    -------------------------------------------------------
     T E S T S
    -------------------------------------------------------
    Running testDep.XXX.xxx.AppTest
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 sec
    
    Results :
    
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    
    [INFO] 
    [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ xxx ---
    [INFO] 
    [INFO] --- maven-install-plugin:2.4:install (default-install) @ xxx ---
    [INFO] Installing D:Anliven-RunningenEclipseProjectsxxx	argetxxx-0.0.1-SNAPSHOT.jar to D:DownLoadFilesapache-maven-repo	estDepXXXxxx.0.1-SNAPSHOTxxx-0.0.1-SNAPSHOT.jar
    [INFO] Installing D:Anliven-RunningenEclipseProjectsxxxpom.xml to D:DownLoadFilesapache-maven-repo	estDepXXXxxx.0.1-SNAPSHOTxxx-0.0.1-SNAPSHOT.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2.520 s
    [INFO] Finished at: 2017-10-24T16:47:36+08:00
    [INFO] Final Memory: 11M/245M
    [INFO] ------------------------------------------------------------------------
    
    

    zzz 执行clean install

    从输出日志可以看到进行了3次构建,并安装到本地仓库中:
    Building xxx 0.0.1-SNAPSHOT
    Building yyy 0.0.1-SNAPSHOT
    Building zzz 0.0.1-SNAPSHOT

    [INFO] Scanning for projects...
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Build Order:
    [INFO] 
    [INFO] xxx
    [INFO] yyy
    [INFO] zzz
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] Building xxx 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ xxx ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory D:Anliven-RunningenEclipseProjectsxxxsrcmain
    esources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ xxx ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ xxx ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory D:Anliven-RunningenEclipseProjectsxxxsrc	est
    esources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ xxx ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ xxx ---
    [INFO] Surefire report directory: D:Anliven-RunningenEclipseProjectsxxx	argetsurefire-reports
    
    -------------------------------------------------------
     T E S T S
    -------------------------------------------------------
    Running testDep.XXX.xxx.AppTest
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.006 sec
    
    Results :
    
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    
    [INFO] 
    [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ xxx ---
    [INFO] Building jar: D:Anliven-RunningenEclipseProjectsxxx	argetxxx-0.0.1-SNAPSHOT.jar
    [INFO] 
    [INFO] --- maven-install-plugin:2.4:install (default-install) @ xxx ---
    [INFO] Installing D:Anliven-RunningenEclipseProjectsxxx	argetxxx-0.0.1-SNAPSHOT.jar to D:DownLoadFilesapache-maven-repo	estDepXXXxxx.0.1-SNAPSHOTxxx-0.0.1-SNAPSHOT.jar
    [INFO] Installing D:Anliven-RunningenEclipseProjectsxxxpom.xml to D:DownLoadFilesapache-maven-repo	estDepXXXxxx.0.1-SNAPSHOTxxx-0.0.1-SNAPSHOT.pom
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] Building yyy 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ yyy ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory D:Anliven-RunningenEclipseProjectsyyysrcmain
    esources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ yyy ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ yyy ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory D:Anliven-RunningenEclipseProjectsyyysrc	est
    esources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ yyy ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ yyy ---
    [INFO] Surefire report directory: D:Anliven-RunningenEclipseProjectsyyy	argetsurefire-reports
    
    -------------------------------------------------------
     T E S T S
    -------------------------------------------------------
    Running testDep.YYY.yyy.AppTest
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 sec
    
    Results :
    
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    
    [INFO] 
    [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ yyy ---
    [INFO] Building jar: D:Anliven-RunningenEclipseProjectsyyy	argetyyy-0.0.1-SNAPSHOT.jar
    [INFO] 
    [INFO] --- maven-install-plugin:2.4:install (default-install) @ yyy ---
    [INFO] Installing D:Anliven-RunningenEclipseProjectsyyy	argetyyy-0.0.1-SNAPSHOT.jar to D:DownLoadFilesapache-maven-repo	estDepYYYyyy.0.1-SNAPSHOTyyy-0.0.1-SNAPSHOT.jar
    [INFO] Installing D:Anliven-RunningenEclipseProjectsyyypom.xml to D:DownLoadFilesapache-maven-repo	estDepYYYyyy.0.1-SNAPSHOTyyy-0.0.1-SNAPSHOT.pom
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] Building zzz 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-install-plugin:2.4:install (default-install) @ zzz ---
    [INFO] Installing D:Anliven-RunningenEclipseProjectszzzpom.xml to D:DownLoadFilesapache-maven-repo	estDepZZzzz.0.1-SNAPSHOTzzz-0.0.1-SNAPSHOT.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] 
    [INFO] xxx ................................................ SUCCESS [  2.282 s]
    [INFO] yyy ................................................ SUCCESS [  0.351 s]
    [INFO] zzz ................................................ SUCCESS [  0.007 s]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2.819 s
    [INFO] Finished at: 2017-10-24T16:43:49+08:00
    [INFO] Final Memory: 12M/309M
    [INFO] ------------------------------------------------------------------------
    
    
  • 相关阅读:
    找轮转后的有序数组中第K小的数
    linux下安装tomcat,并设置自动启动
    maven中添加proguard来混淆代码
    Maven编译可执行jar
    Maven pom项目部署
    Eclipse主题设置
    double hashing 双重哈希
    推荐系统
    vim插件
    多标记学习--Learning from Multi-Label Data
  • 原文地址:https://www.cnblogs.com/anliven/p/7968069.html
Copyright © 2011-2022 走看看