gpt4 book ai didi

java - Maven跳过编译

转载 作者:IT老高 更新时间:2023-10-28 20:34:33 26 4
gpt4 key购买 nike

我想用Maven执行某个插件,只需要源代码,但我不希望Maven编译任何东西(主要是因为项目只是不编译)。

我如何告诉 Maven 跳过编译步骤,只启动它的插件,然后将生成的资源打包到一个漂亮的 JAR 中? (最后一步的过程我已经知道了。)

其他信息:

所以我们现在尝试了很多东西,例如:

<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 包 我们得到这个:

[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

消息已编辑。

最佳答案

<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>

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

关于java - Maven跳过编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13836978/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com