开发者

maven prevent denpendency compile

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜