Maven跳过编译 [英] Maven skip compile
问题描述
我想使用Maven执行仅需要源代码但不希望Maven编译任何东西的插件(主要是因为该项目只是不编译).
I want to use Maven to execute a certain plug-in that only needs the source code but I do not want Maven to compile anything (mostly because the project just doesn't compile).
我如何告诉Maven跳过编译步骤,仅启动其插件,然后将生成的资源打包到一个不错的JAR中? (我已经知道了最后一步的过程.)
How do I tell Maven to skip the compile step and just launch its plug-in and then package the generated resources together in a nice JAR? (The procedure of the last step is already known to me.)
其他信息:
所以我们现在尝试了很多事情,例如:
So we tried a lot of things right now, e.g.:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<excludes>
<exclude>**/*</exclude>
</excludes>
<source>1.7</source>
<target>1.7</target>
</configuration>
<executions>
<execution>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
尽管当我们执行mvn package
时,我们得到了:
Though when we do a mvn package
we get this:
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ project ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling ALOTOF source files to /home/myname/dir/dir/project/target/classes
消息由ofc编辑.
推荐答案
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<skipMain>true</skipMain> <--Skip
</configuration>
</execution>
</executions>
</plugin>
将此选项设置为"true"可绕过主要源代码的编译.它的用途是 不推荐,但有时很方便.用户属性是: maven.main.skip.
Set this to 'true' to bypass compilation of main sources. Its use is NOT RECOMMENDED, but quite convenient on occasion. User property is: maven.main.skip.
mvn package -Dmaven.main.skip
这篇关于Maven跳过编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!