I have a standard java application that I'm building with Maven. It includes a few files under src/main/resource directory. At present, those files are being packaged inside the JAR fiel that is produced, which I would expect, but is there a way to configure the maven assembly plugin to package those files outside of the JAR file, or can I achieve that with another plugin (resources?)?
Related
I have a simple java project with my only source file being in projectName/src/main/java/Example.java . In my pom.xml I have <packaging>ear</packaging> added.
After using Maven's install I can find an .ear file in my target folder.
Problem is, if I open it using 7zip, there are only .jar files associated with my other dependencies, and a META-INF folder with additional folders which contains pom.xml and pom.properties files but nothing about my Example class where I look for.
Have I missed anything?
Is there any way to package a maven project into an .ear file?
My main problem is I have to sign all the JARs of WEB-INF\lib folder.
So this is what I have done:-
Enabled archiveClasses option to package classes also into JAR
Added JAR-Signer Plugin and setting the archive directory to ${project.build.directory}\${project.build.finalName}\WEB-INF\lib
After package finishes, I can check that in target directory all JARs in lib folder are signed but my war file contains unsigned JAR only. Most probably because the jar-signer executed after maven-war-plugin has created the war file.
I tried with setting JAR-Signer to pre-package phase also, but the lib folder is not present by then.
So what I need is to execute Maven JAR-Signer just before maven creates the war file from target directory.
Thanks
I have a project with JNI libraries inside it not in resources folder. I need to create one exetutable jar file.
How to teach maven copy needed files inside jar and put in needed folders?
Please explain how to add my files from lib directory near my project to a jar file using maven. Or how to copy my files and directories to jar using maven?
I am building an Maven based Java web-app. In my src/main/java/package folder I have a .xml file and a .properties file that needs to be included as a part of my war. However when I look at the war file that gets generated (using a maven install) this does not include the .xml and the .properties file. It only contains the .class files from the package.
Is there anyway of including these files in the war ?
In addition, I also checked under the target/classes folder, here again the .xml and .properties files are not included.
Put your .xml file and .properties file in resources folder of your project, by default Maven will pick it up from there.
Little more googling around stackoverflow got me the answer. I just had to change the default resources folder for maven as outline in the following stackoverflow question Why does maven not copy the properties files during the build process?.
Could somebody explain me the exactly differences between these two Maven plugins and when it is useful to work with one of these plugins?
Maven jar plugin simply creates a jar files with all SOURCE files [.class files compiled from .java files] packed in it. However, a jar itself cannot be deployed as it generally has dependencies on 3rd party jar files or other library jar files which are needed to execute SOURCE jar file.
This is where Maven assembly plugin comes into picture. It creates a package of an extension of your choice like .zip, .tar, .gz which is a fully deployable package with all dependencies packed in it. You can also specify directory structure in assembly plugin which should be created when package is deployed on server.
So a assembly plugin is always used in combination with jar plugin.
Maven Jar plugin provides the capability to build and sign jars.The plugin use Maven Archiver to handle jar content and manifest configuration.
Maven Assembly Plugin is used to create all assemblies.
For More Info visit- http://maven.apache.org/plugins/maven-jar-plugin/
http://maven.apache.org/plugins/maven-assembly-plugin/