Maven adds properties file to jar file

I use the following plugin configuration to create a jar file, and I want to include src files without java in the same place in the output bank as described here .

<groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>${java.version}</source> <target>${java.version}</target> <compilerArgument>-Xlint:all</compilerArgument> <showWarnings>true</showWarnings> <showDeprecation>true</showDeprecation> <!-- include non-java src files in the same place in the output jar --> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> </includes> <filtering>true</filtering> </resource> </resources> </configuration> 

The above does not work and does not do the following:

  <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <!-- include non-java src files in the same place in the output jar --> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> </includes> <filtering>true</filtering> </resource> </resources> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>${java.version}</source> <target>${java.version}</target> <compilerArgument>-Xlint:all</compilerArgument> <showWarnings>true</showWarnings> <showDeprecation>true</showDeprecation> </configuration> </plugin> 
+7
java properties jar maven
source share
2 answers

Add file in the same package (folder) to src/main/resources instead of src/main/java or see my answer With maven - a clean package, the xml source files are not included in the classpath

+5
source share

I did it this way and worked great.

  </dependencies> <build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> </includes> </resource> </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> 

+9
source share

All Articles