thank you Wendy, that's wonderful :)

for anyone else wanting to do this, here's what I did:

I went for the second option. details on both are on the maven-war-plugin's
FAQ. it's the second part here:
http://maven.apache.org/plugins/maven-war-plugin/faq.html#attached

this only works in the development version of the war plugin (until 2.1 is
released), so add the following to your <pluginRepositories> tag:

   <pluginRepository>
            <id>snapshots</id>
            <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
   </pluginRepository>

then you can use version 2.1-beta-1-SNAPSHOT of the war plugin.

now when you run the maven build, you get a jar and a war installed to your
repository. but as the jar file has -classes appended to the filename, you
need to tell maven this by adding:

<classifier>classes</classifier>

to the <dependency> tag you need.


thanks again

B



Wendy Smoak-3 wrote:
> 
> On Mon, Jan 12, 2009 at 6:37 AM, Ben Avery <[email protected]> wrote:
> 
> 
>> so I have created a functional-testing module, which contains the tests,
>> but
>> the tests have dependencies on classes in the other modules. I have
>> listed
>> the [war] modules as dependencies of the funtional test pom, but the
>> compile phase
>> fails, as it can't see these classes. if I rig the build to compile the
>> modules as jars instead, the compilation succeeds (but obviously the
>> tests
>> can't run, as I need wars to be deployed).
> 
> This is expected.  Java has no concept of a war file on the classpath.
>  (It expects the directory structure to start at the root of the file,
> it doesn't know to look down under WEB-INF/classes.)
> 
> A couple of options
>  - move the classes out to a separate module and build a jar from
> that, which would then be a "normal" dependency for both the war and
> the tests, or
>  - configure the war plugin to 'attach' the classes as a jar artifact
> in addition to the war, so you can depend on the jar from other
> projects.
> 
> -- 
> Wendy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/war-dependency-not-being-picked-up--tp21414576p21419364.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to