我有不同的独立maven项目,并希望用单个pom构建它。所以我正在使用以下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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>a.b</groupId>
<artifactId>my-sdk</artifactId>
<name>my-sdk</name>
<version>1.0</version>
<packaging>pom</packaging>
<description>Generating SDK</description>
<modules>
<module>project1</module>
<module>project2</module>
<module>project3</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>process-sources</id>
<phase>process-classes</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-classes</phase>
<configuration>
<tasks>
<ant antfile="build.xml" target="init" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jboss-repo</id>
<url>http://repository.jboss.org/maven2</url>
</repository>
</repositories>
我有以下问题: -
Javadoc没有生成,所以我做错了。如果我运行“mvn javadoc:javadoc package”命令,它会生成java doc。但是,如果我运行“mvn package”,它就不会。
在project2中有一个用于生成fat jar的程序集插件,它会生成jar2的jar但无法生成fat jar。如果我独立构建project2,它会成功生成fat jar。
Follwing部分来自project2 pom以生成胖jar,如果我独立运行构建,它会成功运行
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<configuration>
<archive>
<manifest>
<mainClass>[MAIN CLASS]</mainClass>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
</configuration>
<goals>
<goal>assembly</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
任何建议。
答案 0 :(得分:0)
我要检查两个问题的文档; - )
javadoc (http://maven.apache.org/plugins/maven-javadoc-plugin/plugin-info.html)
不应将javadoc:jar 和 javadoc:javadoc 用于聚合器项目,使用 javadoc:aggregate 或(在您的情况下) 的Javadoc:聚集物罐
汇编(http://maven.apache.org/plugins/maven-assembly-plugin/assembly-mojo.html)
首先, assembly:assembly 不推荐使用,其次,它只应在命令行中使用。我想使用目标单会有所帮助。