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>
精彩评论