File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maven - resources files

 
igor kvak
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am trying to create jar with maven and I want also all resources (all .properties files and I have also .png files) to be included
right now all non-java (.class) files are ignored

here is part of my pom.xml file:


and here is also assembly.xml:


There is an article about resources on maven page, but they have all their resources in directery named "resources" and I do not want to do this way

could you help me, how to add resources (in my case .properties and .png files) into jar file?

thanks a lot
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All of you java source should go at src/main/java. All of your resource files should go in src/main/resources. When the build runs, during the process-resources phase the resource are copied to target/classes. Similarly, during the compile phase, the Java source are compiled into target/classes. Then during the package phase, all of the files in target/classes (both resource files and class files) are packaged into a JAR file. This standard Maven practice and you should not try to subvert that (unless you like causing yourself much grief and anguish.)

If you are trying to use the assembly plugin to create the JAR file, you are doing it wrong. The assembly plugin is meant to create an installation or distribution package of your product, it is not meant to build the artifact (JAR file) for the project.
 
igor kvak
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot - it works now

I use assembly plugin to copy all libraries to lib/ directory
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic