开发者

maven prevent denpendency compile

开发者 https://www.devze.com 2022-12-22 05:14 出处:网络
I have a custom jar which including java sources; Maven tries to compile when i开发者_如何学JAVAt builds. How do I skip source compile in the jar file? I have tried such as exclude with some pattern i

I have a custom jar which including java sources; Maven tries to compile when i开发者_如何学JAVAt builds. How do I skip source compile in the jar file? I have tried such as exclude with some pattern in the compiler-plug in and source directory define but I have not get any luck. Thanks!

C05


This is a normal behavior of javac that searches the whole classpath for source files to compile unless the -sourcepath option is given (and this would be the solution here).

Unfortunately, there is a Jira issue about -sourcepath not being passed to javac by the Maven Compiler Plugin (see MCOMPILER-98). But there is a workaround:

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <compilerArguments>
      <sourcepath>${project.basedir}/src/main/java</sourcepath>
    </compilerArguments>
  </configuration>
</plugin>
0

精彩评论

暂无评论...
验证码 换一张
取 消