我的情况是,已经两个多星期了,但我无法解决问题。很抱歉这个问题的描述很长。我想做的是:
我有两个不同的项目,比如说A
,B
我必须使用 Jenkins 来构建它们。虽然他们是独立的,但他们一起工作。所以我创建了不同的存储库并调用它们Repo-A
,Repo-B
并且我能够构建它们。
这是一个真正的问题:现在我想从单个存储库一起构建它们。所以我创建了一个名为 Bitbucket 的存储库,Demo
现在我有两个项目A
和存储库。B
Demo
现在我pom.xml
在存储库中创建了一个文件,Demo
以便我可以将它用作父 POM 和每个项目A
并B
拥有自己的pom.xml
.
项目演示pom.xml
<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>com.demo.parent</groupId>
<artifactId>Parent</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Maven Webapp</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
<!--<url>http://maven.apache.org</url> -->
<modules>
<module>A</module>
<module>B</module>
</modules>
<distributionManagement>
<snapshotRepository>
<id>my-snapshots</id>
<name>Internal Repository</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>my-releases</id>
<name>Internal Repository</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
</repository>
</distributionManagement>
</project>
项目 Apom.xml
<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>com.a.batch</groupId>
<parent>
<groupId>com.demo.parent</groupId>
<artifactId>Parent</artifactId>
<version>0.01-SNAPSHOT</version>
</parent>
<artifactId>A</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>A Maven Webapp</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
<dependencies>
<!-- Spring ORM support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.2.13.RELEASE</version>
</dependency>
<!-- Spring Batch -->
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>3.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-infrastructure</artifactId>
<version>3.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.1</version>
</dependency>
</project>
项目B
的pom.xml
<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>com.B</groupId>
<parent>
<groupId>com.demo.parent</groupId>
<artifactId>Parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>B</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>B Maven Webapp</name>
<!--url>http://maven.apache.org</url-->
<url>http://localhost:8081/nexus/content/repositories/releases</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.13.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.13.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.13.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.2.13.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.2.13.RELEASE</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</project>
现在,当我使用 Jenkins 构建时,构建成功,但 Jenkins 没有生成任何war
文件。它正在生成三个不同的pom
项目。
[INFO] A Maven Webapp ........................... SUCCESS [ 0.351 s]
[INFO] Demo Maven Webapp ............................ SUCCESS [ 0.056 s]
[INFO] B Maven Webapp ....................... SUCCESS [ 0.075 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.453 s
[INFO] Finished at: 2016-04-30T02:59:14+05:30
[INFO] Final Memory: 7M/176M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving /var/lib/jenkins/jobs/Jenkins_Projects/workspace/A/pom.xml to com.A/A/1.0-SNAPSHOT/A-1.0-SNAPSHOT.pom
[JENKINS] Archiving /var/lib/jenkins/jobs/Jenkins_Projects/workspace/B/pom.xml to com.B/B/1.0-SNAPSHOT/B-1.0-SNAPSHOT.pom
[JENKINS] Archiving /var/lib/jenkins/jobs/Jenkins_Projects/workspace/Demo/pom.xml to Demo.Demo/Parent/1.0-SNAPSHOT/Parent-1.0-SNAPSHOT.pom
channel stopped
Finished: SUCCESS
如果我独立构建项目,则构建成功并且我.war
也会获取文件。
但是,当我从同一个存储库构建Demo
并使用父级时,尽管构建成功,但pom.xml
我看不到任何文件。.war
我该如何解决这个问题?
一起构建两个项目的方法是什么?
为什么我得到pom
而不是.war
?
为什么我得到Parent-1.0-SNAPSHOT.pom
虽然这不是一个项目。它只是一个pom
内部存储库。
请指导我。