You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by zm <zz...@hotmail.com> on 2008/07/30 19:27:18 UTC

Maven WAR with self-classes as package

Hi,

I have a WAR project that builds correctly in Maven2.

What I want to know, is if there is a way of making maven to do an internal
JAR package of the WAR classes.

Instead of compiling the java sources and put them in the WEB-INF\classes
internal folder, I would prefer maven to just create a JAR package with
those compiled classes, and put it in the WEB-INF\lib folder.

For example a project named:

my-project-1.0.0.war
would contain:
WEB-INF\lib\my-project-1.0.0.jar or something like that.


Thanks
-- 
View this message in context: http://www.nabble.com/Maven-WAR-with-self-classes-as-package-tp18738442p18738442.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven WAR with self-classes as package

Posted by Mark Struberg <st...@yahoo.de>.
Hi!

The problem may be the 
<outputDirectory>WebContent/WEB-INF/classes</outputDirectory>
in your pom.

Is your webapp stuff also in this WebContent folder? So you use it to generate the classes into your 'source' folder? 

Usually the classes go to target/classes and will be jared there. For what I remember, they will afterwards NOT be removed from this place! So if you use your source folder for holding this classes, they will most likely simply be copied into your war.
Try to remove the <outputDirectory> setting and use war:inplace to generate a debuggable environment.

You can call the single steps from the default lifecyclye manually and watch this directory closely.

LieGrü,
strub

--- zm <zz...@hotmail.com> schrieb am Do, 31.7.2008:

> Von: zm <zz...@hotmail.com>
> Betreff: Re: Maven WAR with self-classes as package
> An: users@maven.apache.org
> Datum: Donnerstag, 31. Juli 2008, 11:18
> My procedure was:
> 
> mvn clean
> 
> I've checked that the target folder has completely
> disappeared, and then
> 
> mvn clean package
> 
> The problem persists.
> 
> 
> Thanks
> 
> 
> 
> Manuel EVENO wrote:
> > 
> > Did you make a clean command before ?
> > 
> > On Thu, Jul 31, 2008 at 10:53 AM, zm
> <zz...@hotmail.com> wrote:
> > 
> >>
> >> It didn't work as expected ... :(
> >>
> >> I have the following in my pon.xml:
> >>
> >>        <build>
> >>
> >> 
> <outputDirectory>WebContent/WEB-INF/classes</outputDirectory>
> >>                <plugins>
> >>                        <plugin>
> >>                               
> >>
> <groupId>org.apache.maven.plugins</groupId>
> >>                               
> <artifactId>maven-war-plugin</artifactId>
> >>                               
> <version>2.0.1</version>
> >>                                <executions>
> >>                                       
> <goal>explode</goal>
> >>                                </executions>
> >>                               
> <configuration>
> >>
> >>  <archiveClasses>true</archiveClasses>
> >>                                       
> <dependentWarIncludes>
> >>                                               
> **/resources/*.*
> >>                                       
> </dependentWarIncludes>
> >>                                       
> <webResources>
> >>                                               
> <resource>
> >>                                                   
>     <!-- this is
> >> relative to the pom.xml directory -->
> >>
> >> 
> <directory>${basedir}/WebContent</directory>
> >>                                               
> </resource>
> >>                                       
> </webResources>
> >>                               
> </configuration>
> >>                        </plugin>
> >>                </plugins>
> >>        </build>
> >>
> >> The problem is that it creates a jar file inside
> lib dir, as expected and
> >> just like I need it. But still it doesn't
> delete the classes from the
> >> WEB-INF\classes folder.
> >>
> >> I've found 
> http://jira.codehaus.org/browse/MWAR-82 this reported issue
> ,
> >> with no solution ... probably was tested, but
> still I don't get the
> >> desired
> >> results.
> >>
> >> Any idea?
> >>
> >> Thanks
> >>
> >>
> >>
> >>
> >> Wendy Smoak-3 wrote:
> >> >
> >> > On Wed, Jul 30, 2008 at 10:27 AM, zm
> <zz...@hotmail.com> wrote:
> >> >
> >> >> I have a WAR project that builds
> correctly in Maven2.
> >> >>
> >> >> What I want to know, is if there is a way
> of making maven to do an
> >> >> internal
> >> >> JAR package of the WAR classes.
> >> >
> >> >
> http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html
> >> >
> >> > archiveClasses - boolean - Whether a JAR file
> will be created for the
> >> > classes in the webapp. Using this optional
> configuration parameter
> >> > will make the generated classes to be
> archived into a jar file and the
> >> > classes directory will then be excluded from
> the webapp. Default value
> >> > is false.
> >> >
> >> > (There is a configuration example on the
> Usage page, just replace the
> >> > parameter name inside the configuration
> element, or ask if you need a
> >> > complete example.)
> >> >
> >> > --
> >> > Wendy
> >> >
> >> >
> ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail:
> users-unsubscribe@maven.apache.org
> >> > For additional commands, e-mail:
> users-help@maven.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Maven-WAR-with-self-classes-as-package-tp18738442p18750322.html
> >> Sent from the Maven - Users mailing list archive
> at Nabble.com.
> >>
> >>
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail:
> users-help@maven.apache.org
> >>
> >>
> > 
> > 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Maven-WAR-with-self-classes-as-package-tp18738442p18750658.html
> Sent from the Maven - Users mailing list archive at
> Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail:
> users-help@maven.apache.org


      __________________________________________________________
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven WAR with self-classes as package

Posted by zm <zz...@hotmail.com>.
My procedure was:

mvn clean

I've checked that the target folder has completely disappeared, and then

mvn clean package

The problem persists.


Thanks



Manuel EVENO wrote:
> 
> Did you make a clean command before ?
> 
> On Thu, Jul 31, 2008 at 10:53 AM, zm <zz...@hotmail.com> wrote:
> 
>>
>> It didn't work as expected ... :(
>>
>> I have the following in my pon.xml:
>>
>>        <build>
>>
>>  <outputDirectory>WebContent/WEB-INF/classes</outputDirectory>
>>                <plugins>
>>                        <plugin>
>>                               
>> <groupId>org.apache.maven.plugins</groupId>
>>                                <artifactId>maven-war-plugin</artifactId>
>>                                <version>2.0.1</version>
>>                                <executions>
>>                                        <goal>explode</goal>
>>                                </executions>
>>                                <configuration>
>>
>>  <archiveClasses>true</archiveClasses>
>>                                        <dependentWarIncludes>
>>                                                **/resources/*.*
>>                                        </dependentWarIncludes>
>>                                        <webResources>
>>                                                <resource>
>>                                                        <!-- this is
>> relative to the pom.xml directory -->
>>
>>  <directory>${basedir}/WebContent</directory>
>>                                                </resource>
>>                                        </webResources>
>>                                </configuration>
>>                        </plugin>
>>                </plugins>
>>        </build>
>>
>> The problem is that it creates a jar file inside lib dir, as expected and
>> just like I need it. But still it doesn't delete the classes from the
>> WEB-INF\classes folder.
>>
>> I've found  http://jira.codehaus.org/browse/MWAR-82 this reported issue ,
>> with no solution ... probably was tested, but still I don't get the
>> desired
>> results.
>>
>> Any idea?
>>
>> Thanks
>>
>>
>>
>>
>> Wendy Smoak-3 wrote:
>> >
>> > On Wed, Jul 30, 2008 at 10:27 AM, zm <zz...@hotmail.com> wrote:
>> >
>> >> I have a WAR project that builds correctly in Maven2.
>> >>
>> >> What I want to know, is if there is a way of making maven to do an
>> >> internal
>> >> JAR package of the WAR classes.
>> >
>> > http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html
>> >
>> > archiveClasses - boolean - Whether a JAR file will be created for the
>> > classes in the webapp. Using this optional configuration parameter
>> > will make the generated classes to be archived into a jar file and the
>> > classes directory will then be excluded from the webapp. Default value
>> > is false.
>> >
>> > (There is a configuration example on the Usage page, just replace the
>> > parameter name inside the configuration element, or ask if you need a
>> > complete example.)
>> >
>> > --
>> > Wendy
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Maven-WAR-with-self-classes-as-package-tp18738442p18750322.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Maven-WAR-with-self-classes-as-package-tp18738442p18750658.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven WAR with self-classes as package

Posted by Manuel EVENO <ma...@gmail.com>.
Did you make a clean command before ?

On Thu, Jul 31, 2008 at 10:53 AM, zm <zz...@hotmail.com> wrote:

>
> It didn't work as expected ... :(
>
> I have the following in my pon.xml:
>
>        <build>
>
>  <outputDirectory>WebContent/WEB-INF/classes</outputDirectory>
>                <plugins>
>                        <plugin>
>                                <groupId>org.apache.maven.plugins</groupId>
>                                <artifactId>maven-war-plugin</artifactId>
>                                <version>2.0.1</version>
>                                <executions>
>                                        <goal>explode</goal>
>                                </executions>
>                                <configuration>
>
>  <archiveClasses>true</archiveClasses>
>                                        <dependentWarIncludes>
>                                                **/resources/*.*
>                                        </dependentWarIncludes>
>                                        <webResources>
>                                                <resource>
>                                                        <!-- this is
> relative to the pom.xml directory -->
>
>  <directory>${basedir}/WebContent</directory>
>                                                </resource>
>                                        </webResources>
>                                </configuration>
>                        </plugin>
>                </plugins>
>        </build>
>
> The problem is that it creates a jar file inside lib dir, as expected and
> just like I need it. But still it doesn't delete the classes from the
> WEB-INF\classes folder.
>
> I've found  http://jira.codehaus.org/browse/MWAR-82 this reported issue ,
> with no solution ... probably was tested, but still I don't get the desired
> results.
>
> Any idea?
>
> Thanks
>
>
>
>
> Wendy Smoak-3 wrote:
> >
> > On Wed, Jul 30, 2008 at 10:27 AM, zm <zz...@hotmail.com> wrote:
> >
> >> I have a WAR project that builds correctly in Maven2.
> >>
> >> What I want to know, is if there is a way of making maven to do an
> >> internal
> >> JAR package of the WAR classes.
> >
> > http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html
> >
> > archiveClasses - boolean - Whether a JAR file will be created for the
> > classes in the webapp. Using this optional configuration parameter
> > will make the generated classes to be archived into a jar file and the
> > classes directory will then be excluded from the webapp. Default value
> > is false.
> >
> > (There is a configuration example on the Usage page, just replace the
> > parameter name inside the configuration element, or ask if you need a
> > complete example.)
> >
> > --
> > Wendy
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Maven-WAR-with-self-classes-as-package-tp18738442p18750322.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Maven WAR with self-classes as package

Posted by zm <zz...@hotmail.com>.
It didn't work as expected ... :(

I have the following in my pon.xml:

	<build>
		<outputDirectory>WebContent/WEB-INF/classes</outputDirectory>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>2.0.1</version>
				<executions>
					<goal>explode</goal>
				</executions>
				<configuration>				
					<archiveClasses>true</archiveClasses>
					<dependentWarIncludes>
						**/resources/*.*
					</dependentWarIncludes>							 
					<webResources>
						<resource>
							<!-- this is relative to the pom.xml directory -->
							<directory>${basedir}/WebContent</directory>
						</resource>
					</webResources>
				</configuration>
			</plugin>			
		</plugins>
	</build>	

The problem is that it creates a jar file inside lib dir, as expected and
just like I need it. But still it doesn't delete the classes from the
WEB-INF\classes folder.

I've found  http://jira.codehaus.org/browse/MWAR-82 this reported issue ,
with no solution ... probably was tested, but still I don't get the desired
results.

Any idea?

Thanks




Wendy Smoak-3 wrote:
> 
> On Wed, Jul 30, 2008 at 10:27 AM, zm <zz...@hotmail.com> wrote:
> 
>> I have a WAR project that builds correctly in Maven2.
>>
>> What I want to know, is if there is a way of making maven to do an
>> internal
>> JAR package of the WAR classes.
> 
> http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html
> 
> archiveClasses - boolean - Whether a JAR file will be created for the
> classes in the webapp. Using this optional configuration parameter
> will make the generated classes to be archived into a jar file and the
> classes directory will then be excluded from the webapp. Default value
> is false.
> 
> (There is a configuration example on the Usage page, just replace the
> parameter name inside the configuration element, or ask if you need a
> complete example.)
> 
> -- 
> Wendy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Maven-WAR-with-self-classes-as-package-tp18738442p18750322.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven WAR with self-classes as package

Posted by zm <zz...@hotmail.com>.
WOW! AWESOME! :)

I'll try this in a minute!


Thanks


Wendy Smoak-3 wrote:
> 
> On Wed, Jul 30, 2008 at 10:27 AM, zm <zz...@hotmail.com> wrote:
> 
>> I have a WAR project that builds correctly in Maven2.
>>
>> What I want to know, is if there is a way of making maven to do an
>> internal
>> JAR package of the WAR classes.
> 
> http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html
> 
> archiveClasses - boolean - Whether a JAR file will be created for the
> classes in the webapp. Using this optional configuration parameter
> will make the generated classes to be archived into a jar file and the
> classes directory will then be excluded from the webapp. Default value
> is false.
> 
> (There is a configuration example on the Usage page, just replace the
> parameter name inside the configuration element, or ask if you need a
> complete example.)
> 
> -- 
> Wendy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Maven-WAR-with-self-classes-as-package-tp18738442p18750119.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven WAR with self-classes as package

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Jul 30, 2008 at 10:27 AM, zm <zz...@hotmail.com> wrote:

> I have a WAR project that builds correctly in Maven2.
>
> What I want to know, is if there is a way of making maven to do an internal
> JAR package of the WAR classes.

http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html

archiveClasses - boolean - Whether a JAR file will be created for the
classes in the webapp. Using this optional configuration parameter
will make the generated classes to be archived into a jar file and the
classes directory will then be excluded from the webapp. Default value
is false.

(There is a configuration example on the Usage page, just replace the
parameter name inside the configuration element, or ask if you need a
complete example.)

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org