You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Sankaran, Nambi" <ns...@ebay.com> on 2013/03/19 21:38:15 UTC
how to include 'src/main/webapp' in a jar file?
Hi All
I have a maven web project that has packaging as "war". the package generates war file that confirms to war format. But, i like to package the project as a "jar" as well along with the default "war" format. So, I am trying to use "maven jar" plugin to achieve that. I am using the following jar plugin configuration.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>make-a-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
<includes>
<include>../../src/main/webapp/**</include>
<include>**/*</include>
</includes>
</configuration>
</plugin>
The "package" command produces a jar file that contains the classes and the contents of 'resources' folder and war file produces a proper 'war' file. But the contents of 'src/main/webapp' are not included in the jar file. How to include the contents of src/main/webapp in the jar using the jar plugin?
Stack Overflow Question
http://stackoverflow.com/questions/15509893/how-to-create-a-war-and-jar-from-a-web-project
Re: how to include 'src/main/webapp' in a jar file?
Posted by Aliaksei Lahachou <al...@gmail.com>.
You may also try maven-assembly-plugin. It may be a little difficult to
configure without experience, but it is very flexible.
Regards,
htfv (Aliaksei Lahachou)
On Wed, Mar 20, 2013 at 1:31 AM, Ron Wheeler <rwheeler@artifact-software.com
> wrote:
> You might think about building the jar as a project first and then making
> the war project depend on the jar project.
> This will give you the jar that you want and the war as well.
>
> Ron
>
>
> On 19/03/2013 4:38 PM, Sankaran, Nambi wrote:
>
>> Hi All
>>
>> I have a maven web project that has packaging as "war". the package
>> generates war file that confirms to war format. But, i like to package the
>> project as a "jar" as well along with the default "war" format. So, I am
>> trying to use "maven jar" plugin to achieve that. I am using the following
>> jar plugin configuration.
>>
>>
>> <plugin>
>> <groupId>org.apache.maven.**plugins</groupId>
>> <artifactId>maven-jar-plugin</**artifactId>
>> <executions>
>> <execution>
>> <id>make-a-jar</id>
>> <phase>package</phase>
>> <goals>
>> <goal>jar</goal>
>> </goals>
>> </execution>
>> </executions>
>> <configuration>
>> <classesDirectory>${project.**build.outputDirectory}</**
>> classesDirectory>
>> <includes>
>> <include>../../src/main/**webapp/**</include>
>> <include>**/*</include>
>> </includes>
>> </configuration>
>> </plugin>
>>
>> The "package" command produces a jar file that contains the classes and
>> the contents of 'resources' folder and war file produces a proper 'war'
>> file. But the contents of 'src/main/webapp' are not included in the jar
>> file. How to include the contents of src/main/webapp in the jar using the
>> jar plugin?
>>
>> Stack Overflow Question
>> http://stackoverflow.com/**questions/15509893/how-to-**
>> create-a-war-and-jar-from-a-**web-project<http://stackoverflow.com/questions/15509893/how-to-create-a-war-and-jar-from-a-web-project>
>>
>>
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: how to include 'src/main/webapp' in a jar file?
Posted by Ron Wheeler <rw...@artifact-software.com>.
You might think about building the jar as a project first and then
making the war project depend on the jar project.
This will give you the jar that you want and the war as well.
Ron
On 19/03/2013 4:38 PM, Sankaran, Nambi wrote:
> Hi All
>
> I have a maven web project that has packaging as "war". the package generates war file that confirms to war format. But, i like to package the project as a "jar" as well along with the default "war" format. So, I am trying to use "maven jar" plugin to achieve that. I am using the following jar plugin configuration.
>
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-jar-plugin</artifactId>
> <executions>
> <execution>
> <id>make-a-jar</id>
> <phase>package</phase>
> <goals>
> <goal>jar</goal>
> </goals>
> </execution>
> </executions>
> <configuration>
> <classesDirectory>${project.build.outputDirectory}</classesDirectory>
> <includes>
> <include>../../src/main/webapp/**</include>
> <include>**/*</include>
> </includes>
> </configuration>
> </plugin>
>
> The "package" command produces a jar file that contains the classes and the contents of 'resources' folder and war file produces a proper 'war' file. But the contents of 'src/main/webapp' are not included in the jar file. How to include the contents of src/main/webapp in the jar using the jar plugin?
>
> Stack Overflow Question
> http://stackoverflow.com/questions/15509893/how-to-create-a-war-and-jar-from-a-web-project
>
--
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org