You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Karl Heinz Marbaise <ka...@soebes.de> on 2011/11/23 13:10:24 UTC
Integration Test Dependency and WAR Packaging
Hi to all,
i have a larger structure of modules which built a multi-module-build which
contains (an excerpt of my structure) the following two modules where my
problem is focused on:
root
+-- mod-war
+-- mod-it
where the mod-war obviously contains the WAR module with the web-application
(packaging war) and the mod-it contains the integration tests. So my problem
is that i can't use a Class which is defined in the mod-war package under
src/main/java/..../ClassName.java in my Integration test
(src/test/java/XYZIT.java)....
I already have a dependency to my mod-war to make sure the reactor will
build the mod-war before mod-it
...
Here my snippet from the mod-it POM:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mod-war</artifactId>
<version>${project.version}</version>
<type>war</type>
<scope>test</scope>
</dependency>
So the question is: Does exist a solution? Or do i need to define a separate
module with my classes which i would like to use in my integration tests and
in the mod-war ?
Kind regards
Karl Heinz Marbaise
-----
Kind regards
Karl Heinz Marbaise
----
http://www.soebes.de
http://www.skmwiki.de
http://supose.org/wiki/supose
--
View this message in context: http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5016434.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: Integration Test Dependency and WAR Packaging
Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi,
after a longer fight with my build...didn't saw that i had a classloader
problem (some dependencies which came via the new dependency (classes)) now
this works perfect....
Many thanks for the support....
Kind regards
Karl Heinz Marbaise
-----
Kind regards
Karl Heinz Marbaise
----
http://www.soebes.de
http://www.skmwiki.de
http://supose.org/wiki/supose
--
View this message in context: http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5017507.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: Integration Test Dependency and WAR Packaging
Posted by "Asmann, Roland" <Ro...@adesso.at>.
No attachments allowed? I'll send it to you directly.
On 23.11.2011 17:08, Asmann, Roland wrote:
> Here's a small example... Check if it works for you, because it
> definitely does for me...
>
> Roland
>
>
> On 23.11.2011 16:52, Karl Heinz Marbaise wrote:
> > Hi,
> >
> > Asmann, Roland wrote
> > >
> > > If you use 'attachClasses', the JAR should NOT be created in the
> > > lib-folder, but in the target. When using 'archiveClasses' it is
> created
> > > in the lib-folder.
> >
> > It is correct that a file artifactid-version-classes.jar is created
> in the
> > target folder (with attachClasses), but that does not contain the classes
> > from src/main/java. The documentation says it will put the classes
> from the
> > src/main/webapp/WEB-INF/classes folder into this jar...
> >
> > The jar which is created in the
> > target/artifactid-version/WEB-INF/lib/artifact-version.jar contains the
> > classes from src/main/java....but can't be correctly be used as a
> > dependency....it will produce a problems during the build, cause it
> will try
> > to download that jar from the repo-manager...which does not exists...
> >
> >
> > Asmann, Roland wrote
> > >
> > > A dependency on that JAR should be on a JAR (not the WAR) and add
> > > classifier 'classes'.
> > >
> > Will not work based on the above description....
> >
> > I've got the impression this looks like a bug in the
> Maven-War-Plugin....or
> > a misunderstanding on my site...
> >
> > Kind regards
> > Karl Heinz Marbaise
> >
> > -----
> > Kind regards
> > Karl Heinz Marbaise
> > ----
> > http://www.soebes.de
> > http://www.skmwiki.de
> > http://supose.org/wiki/supose
> > --
> > View this message in context:
> >
> http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5017124.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
> >
>
> --
> Roland Asmann
> Senior Software Engineer
>
> adesso Austria GmbH
> Floridotower 26. Stock T +43 1 2198790-27
> Floridsdorfer Hauptstr. 1 F +43 1 2198790-927
> A-1210 Wien M +43 664 88657566
> E roland.asmann@adesso.at
> W www.adesso.at
>
> -------------------------------------------------------------
> >>> business. people. technology. <<<
> -------------------------------------------------------------
>
--
Roland Asmann
Senior Software Engineer
adesso Austria GmbH
Floridotower 26. Stock T +43 1 2198790-27
Floridsdorfer Hauptstr. 1 F +43 1 2198790-927
A-1210 Wien M +43 664 88657566
E roland.asmann@adesso.at
W www.adesso.at
-------------------------------------------------------------
>>> business. people. technology. <<<
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Integration Test Dependency and WAR Packaging
Posted by "Asmann, Roland" <Ro...@adesso.at>.
Here's a small example... Check if it works for you, because it
definitely does for me...
Roland
On 23.11.2011 16:52, Karl Heinz Marbaise wrote:
> Hi,
>
> Asmann, Roland wrote
> >
> > If you use 'attachClasses', the JAR should NOT be created in the
> > lib-folder, but in the target. When using 'archiveClasses' it is created
> > in the lib-folder.
>
> It is correct that a file artifactid-version-classes.jar is created in the
> target folder (with attachClasses), but that does not contain the classes
> from src/main/java. The documentation says it will put the classes from the
> src/main/webapp/WEB-INF/classes folder into this jar...
>
> The jar which is created in the
> target/artifactid-version/WEB-INF/lib/artifact-version.jar contains the
> classes from src/main/java....but can't be correctly be used as a
> dependency....it will produce a problems during the build, cause it will try
> to download that jar from the repo-manager...which does not exists...
>
>
> Asmann, Roland wrote
> >
> > A dependency on that JAR should be on a JAR (not the WAR) and add
> > classifier 'classes'.
> >
> Will not work based on the above description....
>
> I've got the impression this looks like a bug in the Maven-War-Plugin....or
> a misunderstanding on my site...
>
> Kind regards
> Karl Heinz Marbaise
>
> -----
> Kind regards
> Karl Heinz Marbaise
> ----
> http://www.soebes.de
> http://www.skmwiki.de
> http://supose.org/wiki/supose
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5017124.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
>
--
Roland Asmann
Senior Software Engineer
adesso Austria GmbH
Floridotower 26. Stock T +43 1 2198790-27
Floridsdorfer Hauptstr. 1 F +43 1 2198790-927
A-1210 Wien M +43 664 88657566
E roland.asmann@adesso.at
W www.adesso.at
-------------------------------------------------------------
>>> business. people. technology. <<<
-------------------------------------------------------------
Re: Integration Test Dependency and WAR Packaging
Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi,
Asmann, Roland wrote
>
> If you use 'attachClasses', the JAR should NOT be created in the
> lib-folder, but in the target. When using 'archiveClasses' it is created
> in the lib-folder.
It is correct that a file artifactid-version-classes.jar is created in the
target folder (with attachClasses), but that does not contain the classes
from src/main/java. The documentation says it will put the classes from the
src/main/webapp/WEB-INF/classes folder into this jar...
The jar which is created in the
target/artifactid-version/WEB-INF/lib/artifact-version.jar contains the
classes from src/main/java....but can't be correctly be used as a
dependency....it will produce a problems during the build, cause it will try
to download that jar from the repo-manager...which does not exists...
Asmann, Roland wrote
>
> A dependency on that JAR should be on a JAR (not the WAR) and add
> classifier 'classes'.
>
Will not work based on the above description....
I've got the impression this looks like a bug in the Maven-War-Plugin....or
a misunderstanding on my site...
Kind regards
Karl Heinz Marbaise
-----
Kind regards
Karl Heinz Marbaise
----
http://www.soebes.de
http://www.skmwiki.de
http://supose.org/wiki/supose
--
View this message in context: http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5017124.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: Integration Test Dependency and WAR Packaging
Posted by "Asmann, Roland" <Ro...@adesso.at>.
If you use 'attachClasses', the JAR should NOT be created in the
lib-folder, but in the target. When using 'archiveClasses' it is created
in the lib-folder.
A dependency on that JAR should be on a JAR (not the WAR) and add
classifier 'classes'.
On 23.11.2011 14:42, Karl Heinz Marbaise wrote:
> Hi,
>
> i've looked into the wrong location ....oversight ... sorry ;-( ....the jar
> file is created in the WEB-INF/lib/ folder and not in the target folder ....
>
> but now i'm trying to use it as dependency for my integration test module
> and use classes from there....but this seemed to be not working...
>
> Hm....
>
> Kind regards
> Karl Heinz Marbaise
>
> -----
> Kind regards
> Karl Heinz Marbaise
> ----
> http://www.soebes.de
> http://www.skmwiki.de
> http://supose.org/wiki/supose
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5016683.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
>
--
Roland Asmann
Senior Software Engineer
adesso Austria GmbH
Floridotower 26. Stock T +43 1 2198790-27
Floridsdorfer Hauptstr. 1 F +43 1 2198790-927
A-1210 Wien M +43 664 88657566
E roland.asmann@adesso.at
W www.adesso.at
-------------------------------------------------------------
>>> business. people. technology. <<<
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Integration Test Dependency and WAR Packaging
Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi,
i've looked into the wrong location ....oversight ... sorry ;-( ....the jar
file is created in the WEB-INF/lib/ folder and not in the target folder ....
but now i'm trying to use it as dependency for my integration test module
and use classes from there....but this seemed to be not working...
Hm....
Kind regards
Karl Heinz Marbaise
-----
Kind regards
Karl Heinz Marbaise
----
http://www.soebes.de
http://www.skmwiki.de
http://supose.org/wiki/supose
--
View this message in context: http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5016683.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: Integration Test Dependency and WAR Packaging
Posted by "Asmann, Roland" <Ro...@adesso.at>.
Strange, that's the same version I am using...
Could you post a part of the POM and maybe some output you get? Maybe we
can see something in there...
On 23.11.2011 14:29, Karl Heinz Marbaise wrote:
> Hi,
>
>
> Asmann, Roland wrote
> >
> > I just tried this on an old project, and with only the
> > 'attacheClasses'-attribute, it works just fine for me...
> >
> > Might be a dumb question, but: are you using the right version of the
> > plugin?
> >
> it's not a dump question... ;-)
>
> I'm using maven-war-plugin (2.1.1) most up-to-date version of the
> plugin...rechecked it ...
>
> Kind regards
> Karl Heinz Marbaise
>
> -----
> Kind regards
> Karl Heinz Marbaise
> ----
> http://www.soebes.de
> http://www.skmwiki.de
> http://supose.org/wiki/supose
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5016649.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
>
--
Roland Asmann
Senior Software Engineer
adesso Austria GmbH
Floridotower 26. Stock T +43 1 2198790-27
Floridsdorfer Hauptstr. 1 F +43 1 2198790-927
A-1210 Wien M +43 664 88657566
E roland.asmann@adesso.at
W www.adesso.at
-------------------------------------------------------------
>>> business. people. technology. <<<
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Integration Test Dependency and WAR Packaging
Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi,
Asmann, Roland wrote
>
> I just tried this on an old project, and with only the
> 'attacheClasses'-attribute, it works just fine for me...
>
> Might be a dumb question, but: are you using the right version of the
> plugin?
>
it's not a dump question... ;-)
I'm using maven-war-plugin (2.1.1) most up-to-date version of the
plugin...rechecked it ...
Kind regards
Karl Heinz Marbaise
-----
Kind regards
Karl Heinz Marbaise
----
http://www.soebes.de
http://www.skmwiki.de
http://supose.org/wiki/supose
--
View this message in context: http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5016649.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: Integration Test Dependency and WAR Packaging
Posted by "Asmann, Roland" <Ro...@adesso.at>.
I just tried this on an old project, and with only the
'attacheClasses'-attribute, it works just fine for me...
Might be a dumb question, but: are you using the right version of the
plugin?
Roland
On 23.11.2011 13:55, Karl Heinz Marbaise wrote:
> hi,
>
> i have added both parameters to the configuration of the maven-war-plugin
> but it doesn't create a separate jar file...so no luck...
>
> Kind regards
> Karl Heinz Marbaise
>
> -----
> Kind regards
> Karl Heinz Marbaise
> ----
> http://www.soebes.de
> http://www.skmwiki.de
> http://supose.org/wiki/supose
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5016562.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
>
--
Roland Asmann
Senior Software Engineer
adesso Austria GmbH
Floridotower 26. Stock T +43 1 2198790-27
Floridsdorfer Hauptstr. 1 F +43 1 2198790-927
A-1210 Wien M +43 664 88657566
E roland.asmann@adesso.at
W www.adesso.at
-------------------------------------------------------------
>>> business. people. technology. <<<
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Integration Test Dependency and WAR Packaging
Posted by Karl Heinz Marbaise <ka...@soebes.de>.
hi,
i have added both parameters to the configuration of the maven-war-plugin
but it doesn't create a separate jar file...so no luck...
Kind regards
Karl Heinz Marbaise
-----
Kind regards
Karl Heinz Marbaise
----
http://www.soebes.de
http://www.skmwiki.de
http://supose.org/wiki/supose
--
View this message in context: http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5016562.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: Integration Test Dependency and WAR Packaging
Posted by "Asmann, Roland" <Ro...@adesso.at>.
Hello Karl Heinz,
Where does it say that the sources must be in src/main/webapp? As with
all plugins, sources should be in src/main/java (like you have now).
I think you need the parameter 'attachClasses', I am not 100% sure if
'archiveClasses' is necessary as well.
I've used it before (albeit a little while back so I can't remember all
the details) and it does what you want.
Roland
On 23.11.2011 13:28, Karl Heinz Marbaise wrote:
> Hi,
>
> first thanks for the answer, but the problem is my classes are located in
> the src/main/java area and not in src/main/webapp folder....The
> configuration for the war-plugin (archiveClasses) will only create a jar
> from classes in the src/main/webapp folder...where i don't have any classes
> only jsp(x), css files, images etc. My classes are located in src/main/java
> ...
>
> Kind regards
> Karl Heinz Marbaise
>
>
>
> -----
> Kind regards
> Karl Heinz Marbaise
> ----
> http://www.soebes.de
> http://www.skmwiki.de
> http://supose.org/wiki/supose
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5016484.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
>
--
Roland Asmann
Senior Software Engineer
adesso Austria GmbH
Floridotower 26. Stock T +43 1 2198790-27
Floridsdorfer Hauptstr. 1 F +43 1 2198790-927
A-1210 Wien M +43 664 88657566
E roland.asmann@adesso.at
W www.adesso.at
-------------------------------------------------------------
>>> business. people. technology. <<<
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Integration Test Dependency and WAR Packaging
Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi,
first thanks for the answer, but the problem is my classes are located in
the src/main/java area and not in src/main/webapp folder....The
configuration for the war-plugin (archiveClasses) will only create a jar
from classes in the src/main/webapp folder...where i don't have any classes
only jsp(x), css files, images etc. My classes are located in src/main/java
...
Kind regards
Karl Heinz Marbaise
-----
Kind regards
Karl Heinz Marbaise
----
http://www.soebes.de
http://www.skmwiki.de
http://supose.org/wiki/supose
--
View this message in context: http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5016484.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: Integration Test Dependency and WAR Packaging
Posted by "Asmann, Roland" <Ro...@adesso.at>.
Hi Karl Heinz,
Look at the configuration for the WAR-plugin, you can have it create a
separate JAR for the classes, which you can then use as a dependency.
Roland
On 23.11.2011 13:10, Karl Heinz Marbaise wrote:
> Hi to all,
>
> i have a larger structure of modules which built a multi-module-build which
> contains (an excerpt of my structure) the following two modules where my
> problem is focused on:
>
> root
> +-- mod-war
> +-- mod-it
>
> where the mod-war obviously contains the WAR module with the web-application
> (packaging war) and the mod-it contains the integration tests. So my problem
> is that i can't use a Class which is defined in the mod-war package under
> src/main/java/..../ClassName.java in my Integration test
> (src/test/java/XYZIT.java)....
>
> I already have a dependency to my mod-war to make sure the reactor will
> build the mod-war before mod-it
> ...
>
> Here my snippet from the mod-it POM:
>
> <dependency>
> <groupId>${project.groupId}</groupId>
> <artifactId>mod-war</artifactId>
> <version>${project.version}</version>
> <type>war</type>
> <scope>test</scope>
> </dependency>
>
> So the question is: Does exist a solution? Or do i need to define a separate
> module with my classes which i would like to use in my integration tests and
> in the mod-war ?
>
> Kind regards
> Karl Heinz Marbaise
>
>
> -----
> Kind regards
> Karl Heinz Marbaise
> ----
> http://www.soebes.de
> http://www.skmwiki.de
> http://supose.org/wiki/supose
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Integration-Test-Dependency-and-WAR-Packaging-tp5016434p5016434.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
>
--
Roland Asmann
Senior Software Engineer
adesso Austria GmbH
Floridotower 26. Stock T +43 1 2198790-27
Floridsdorfer Hauptstr. 1 F +43 1 2198790-927
A-1210 Wien M +43 664 88657566
E roland.asmann@adesso.at
W www.adesso.at
-------------------------------------------------------------
>>> business. people. technology. <<<
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Integration Test Dependency and WAR Packaging
Posted by Dirk Olmes <di...@xanthippe.ping.de>.
On 11/23/2011 01:10 PM, Karl Heinz Marbaise wrote:
> Hi to all,
>
> i have a larger structure of modules which built a multi-module-build which
> contains (an excerpt of my structure) the following two modules where my
> problem is focused on:
>
> root
> +-- mod-war
> +-- mod-it
>
> where the mod-war obviously contains the WAR module with the web-application
> (packaging war) and the mod-it contains the integration tests. So my problem
> is that i can't use a Class which is defined in the mod-war package under
> src/main/java/..../ClassName.java in my Integration test
> (src/test/java/XYZIT.java)....
This doesn't directly address your question but the .war module should
not even have sources IMHO. I always structure my projects so that the
war module only has the direct stuff required for the .war (e.g. web.xml
and friends) but nothing else.
-dirk
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org