How to exclude java sources from third-party banks?

I have one jar dependency in my java project that also contains sources, and when I run mvn compilation, these java sources appear as class files in my maven compiled output: (... How can I exclude these files. . (I want my own compiled files to be compiled)

I tried something like:

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.1-SNAPSHOT</version> <configuration> <excludes> <exclude>**/bv/**/*.java</exclude> </excludes> </configuration> </plugin> 

It is played with it, but they continue to appear on my maven compiled output :( ..

Any idea?

+2
source share
3 answers

I understand that this is normal javac behavior, which looks all the way to classes to compile source files, if only -sourcepath (and this will be the solution here).

Unfortunately, Jira's o -sourcepath not passed to javac Maven Compiler plugin (see MCOMPILER-98 ), but there is a workaround. So could you try:

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

Will the provided work area work?

From: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html :

This is very similar to compilation, but indicates that you expect a JDK or container to provide runtime dependency.

+2
source

You can pass the -implicit:none parameter to the compiler

  <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <compilerArgument>-implicit:none</compilerArgument> </configuration> </plugin> 
0
source

Source: https://habr.com/ru/post/1342514/


All Articles