我多模块Maven项目如PROJ-A,PROJ-B,PROJ-C。在这些项目中,有一个名为assemler项目基本上创造了通过多模块项目的POM产生的所有jar文件的zip文件。汇编项目使用Maven的组装插件准备的zip文件。我的问题是,多模块项目的POM文件不编译错误失败。随后,汇编POM创建压缩文件,无论有编译错误与否。我怎样才能阻止汇编项目以创建压缩文件,如果有一个编译错误?
这里是多模块项目的pom.xml
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>com.my.projects</groupId>
<artifactId>packer</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<modules>
<module>../../com.proj-a</module>
<module>../../com.proj-b</module>
<module>../../com.proj-c</module>
...........
<!-- assembling all jars -->
<module>./assembler</module>
</modules>
汇编的pom.xml的是
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>com.my.projects</groupId>
<artifactId>assembler</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>com.my.projects</groupId>
<artifactId>com.proj-a</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.my.projects</groupId>
<artifactId>com.proj-b</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.my.projects</groupId>
<artifactId>com.proj-c</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-bundles</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>release-all-for-test</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>/src/resources/assembly-descriptor.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
而装配descriptor.xml是
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>dist-assembly</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<useTransitiveDependencies>false</useTransitiveDependencies>
<outputDirectory>/out-put/WEB-INF/lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<unpack>false</unpack>
</dependencySet>
</dependencySets>
</assembly>
检查模块PROJ-A,PROJ-B,PROJ-C以及它们的主模块行家编译-插件配置。该插件可能已被配置为不失败的编译错误。它通常应该会失败的编译错误。该插件的选项被称为failOnError。https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#failOnError
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句