This page describes my problem -

https://github.com/koyadume/piston-master/wiki/App

- Shailendra

> Date: Fri, 19 Dec 2014 08:09:35 -0500
> From: [email protected]
> To: [email protected]
> Subject: Re: Creating a jar and a war from a war project
> 
> Starting with an explanation of what you are trying to accomplish rather 
> than with what problem you are experiencing, usually makes the problem 
> easier to solve and makes the advice you get actually helpful.
> 
> What are you trying to do that makes your requirements so non-standard?
> 
> If you are just trying to separate the war from the code, this is pretty 
> standard and a good idea.
> You make 2 projects, one to make the jar and another to make the war.
> Both become trivial examples of maven projects and do not require any 
> crazy plug-in configurations.
> The war has a dependency on the jar.
> 
> If you want to install the jar separately from your war(jar not included 
> the war), make the jar dependency in your war POM as scope "provided".
> Maven will not put any jar contents in the war file and will leave it up 
> to the Servlet container to find the classes.
> The jar is nothing special and all of the components will be where they 
> are supposed to be and you will have no trouble when you try to run your 
> app.
> 
> http://blog.artifact-software.com/tech/?tag=maven has some articles that 
> I wrote on making multi-project application work with Maven with this 
> sort of separation of libraries from war configuration.
> 
> Ron
> 
> On 19/12/2014 5:18 AM, Robert Scholte wrote:
> > 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]
> >
> >
> 
> 
> -- 
> Ron Wheeler
> President
> Artifact Software Inc
> email: [email protected]
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
                                          

Reply via email to