I have a folder myApp1 and pom.xml is lying inside myApp1. Here is the hirerchy of myApp1
myAppl1
|--src
|--main
|--java
(Java Source Code)
|--resources
some xml files and doc files
|--pom.xml
Now if i do mvn package it build all the folders and makes jar files(basically it puts also all the files under resources folder in jar file).
What i want is to build the files under java folder only which does not have any dependency on resources folder(java files dependencies are mentioned in POM file which are jars in repository).
I am not sure how we can build the specific folder in maven. I tried this mvn install -pl src\main\java -am but says Could not find the selected project in the reactor?
EDIT This is how i had put it in pom.xml before
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
<configuration>
<verbose>true</verbose>
<excludes>
<exclude>resources/*</exclude>
<exclude>webapp/*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
But i get [ERROR] Malformed POM C:\myProject\pom.xml: Unrecognised tag: ‘pluginMana
gement’ (position: START_TAG seen …\r\n\r\n
… @55:21) @ C:\myProject\pom.xml, line 55, column 21 -> [Help 2]
You have to use
maven-jar-pluginand configure it to exclude the files or directories which you do not want to include it in your JAR. Also, check out its usage on Maven site. Following is a sample configuration formaven-jar-plugin: