[英]How to create a new classes for each compilation using maven plugin
In case of my project I need to create new classes after each compilation. 对于我的项目,我需要在每次编译后创建新的类。 For compilation I'm using maven compiler plugin 3.1. 为了进行编译,我使用了maven编译器插件3.1。 I tried to use compilerReuseStrategy = alwaysNew option but it didn't make any affect, it always compile only changed classes. 我尝试使用compileReuseStrategy = alwaysNew选项,但它没有任何影响,它始终仅编译更改的类。 Here is plugin declaration in pom.xml: 这是pom.xml中的插件声明:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerReuseStrategy>alwaysNew</compilerReuseStrategy>
</configuration>
</plugin>
An I doing something wrong or that's a bug and this option really doesn't work? 我做错了还是那是个错误,这个选项真的行不通吗?
If you are talking about the incremental feature fo the maven-compiler-plugin you can change this behaviour by the following configuration : 如果您正在谈论maven-compiler-plugin的增量功能,则可以通过以下配置更改此行为:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
The compileReuseStrategy in contradiction is intended to define the behaviour in relationship with multi-threaded running of the compiler. 矛盾的compileReuseStrategy旨在定义与编译器的多线程运行有关的行为。
使用mvn clean install
怎么办?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.