Re-reading your request...
bq. Jar
- This should contain all the class files and dependencies of war
project. However dependencies should be copied under lib folder of this
jar and should not be in unpacked form.
I hope you are aware that this conflicts with the jar-specs. The classes
inside the lib/*.jars won't end up on the classpath, which makes this jar
useless.
I'd strongly advice you not to solve it as you described.
thanks,
Robert
Op Fri, 19 Dec 2014 10:33:19 +0100 schreef shailendra singh
<[email protected]>:
Hi,
Thank you for your response.
I am already aware about these two parameters.
I don't thing 'archiveClasses' parameter will be of any help in my case.
I had tried to use 'attachClasses' initially but I could not figure out
how to pull war dependencies (and that too in a lib folder) in the jar
file which will be generated by setting this parameter to true.
So I have no solution for my problem yet.
Thanks
Shailendra
To: [email protected]
Subject: Re: Creating a jar and a war from a war project
Date: Fri, 19 Dec 2014 09:54:58 +0100
From: [email protected]
Hi,
have a look at the following parameters of the manve-war plugin:
- archiveClasses[1]
- attachClasses[2]
I suggest *not* to use the maven-assembly-plugin in this case. It'll
make
things over-complex.
thanks,
Robert
[1]
http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#archiveClasses
[2]
http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#attachClasses
Op Fri, 19 Dec 2014 08:03:22 +0100 schreef shailendra singh
<[email protected]>:
> Hi,
>
> For some reason I am struggling to
> create a war and a jar from a maven war project. I want to create
these
> two artifacts from my maven war project with following requirements -
>
> Jar
> - This should contain all the class files and dependencies of war
> project. However dependencies should be copied under lib folder of
this
> jar and should not be in unpacked form. This part is giving me
problem.
>
> War
> - For war I simply want to have static artifacts and nothing which is
> present under WEB-INF folder. I am able to achieve this using maven
war
> plugin.
>
> Here is the code present under <build> tag of my pom.xml -
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.8</source>
> <target>1.8</target>
> </configuration>
> </plugin>
> <plugin>
> <artifactId>maven-assembly-plugin</artifactId>
> <configuration>
> <descriptors>
> <descriptor>assembly.xml</descriptor>
> </descriptors>
> <appendAssemblyId>false</appendAssemblyId>
> <archive>
> <manifest>
> <addClasspath>true</addClasspath>
> <classpathPrefix>lib/</classpathPrefix>
> </manifest>
> </archive>
> </configuration>
> <executions>
> <execution>
> <id>jar-with-dependencies-in-lib</id>
> <phase>package</phase>
> <goals>
> <goal>single</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> <plugin>
> <artifactId>maven-war-plugin</artifactId>
> <configuration>
> <packagingExcludes>WEB-INF/</packagingExcludes>
> <failOnMissingWebXml>false</failOnMissingWebXml>
> </configuration>
> </plugin>
>
> </plugins>
> </build>
>
> Here is content of assembly.xml file which is located directly under
> project root directory -
>
> <assembly
>
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
> http://maven.apache.org/xsd/assembly-1.1.2.xsd">
> <id>jar-with-dependencies-in-lib</id>
> <formats>
> <format>jar</format>
> </formats>
> <includeBaseDirectory>false</includeBaseDirectory>
> <fileSets>
> <fileSet>
>
<directory>target/${project.artifactId}-${project.version}/WEB-INF/lib</directory>
> <includes>
>
<include>target/${project.artifactId}-${project.version}/WEB-INF/classes</include>
> </includes>
> </fileSet>
> </fileSets>
> </assembly>
>
> I
> feel that I don't need maven-war-plugin at all and both the artifacts
> can be created using maven assembly plugin only. However I am unable
to
> figure out how to achieve this.
>
> - Shailendra
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]