我有一个项目,可以从xsd模式生成带有jaxb的Java类。
pom包含
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
<configuration>
<!-- The package of your generated sources -->
<packageName>com.melexis.mfgdil.b2mml</packageName>
<sources>
<source>src/main/schema/AllSchemas.xsd</source>
</sources>
</configuration>
</plugin>
当我输入mvn clean install
时,java源是从
将xsd文件放到 target / generated-sources / jaxb 中,然后编译并以 target / classes 结尾,太棒了!
当我敢于立即再次运行mvn install
而不进行任何更改时,我会看到:
[INFO] --- jaxb2-maven-plugin:2.2:xjc (xjc) @ b2mml ---
[INFO] Ignored given or default xjbSources
[/home/pti/Projects/b2mml/src/main/xjb], since it is not an existent file or directory.
[INFO] No changes detected in schema or binding files - skipping JAXB
generation.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ b2mml ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ b2mml ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/pti/Projects/b2mml/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ b2mml ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/pti/Projects/b2mml/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @
b2mml- [INFO]无需编译-所有类都是最新的 [INFO]
target / classes 文件夹被擦除,并且 target / generated-sources 中的所有类都消失了,而我<留下了em> src / main / java 树。
我不明白为什么Maven会检测到更改,而得到的结果甚至更少,那就是Maven然后重新编译模块,但是忘记了生成的源代码。我忘记了什么?