Maven 2.x WAR Plugin

<webResources> copy fails in a multi-project build

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0.2
  • Fix Version/s: 2.1-alpha-1
  • Component/s: None
  • Labels:
    None
  • Environment:
    Maven 2.0.4, maven-war-plugin trunk r453448, Sun Java 1.5, Ubuntu Linux
  • Number of attachments :
    2

Description

In this example project (attached as test-project.tar.gz)

– foo-bar-webapp
  – pom.xml
`-- src
`-- main
  – resources
  `-- foo.properties
`-- webapp
  – WEB-INF
  `-- web.xml
`-- index.jsp
`-- pom.xml

Executing 'mvn package' from the foo-bar-webapp directory succeeds, but executing 'mvn package' from the parent project directory fails with:
java.lang.IllegalStateException: basedir src/main/resources does not exist
at org.codehaus.plexus.util.DirectoryScanner.scan(DirectoryScanner.java:542)
at org.apache.maven.plugin.war.AbstractWarMojo.getWarFiles(AbstractWarMojo.java:821)
at org.apache.maven.plugin.war.AbstractWarMojo.copyResources(AbstractWarMojo.java:405)
at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:515)
at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:344)
at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:161)
at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:127)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

The foo-bar-webapp/pom.xml contains:
<build>
<finalName>foo-bar-webapp</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>

  1. MWAR-79.patch
    06/Oct/06 9:08 PM
    0.9 kB
    Elliot Metsger
  2. test-project.tar.gz
    06/Oct/06 9:05 PM
    1 kB
    Elliot Metsger

Issue Links

Activity

Hide
Elliot Metsger added a comment -

Prepending the Project's baseDir to the resource directory (if the resource directory is not absolute) fixed this issue. Attached is a patch. Please review and consider for the 2.0.2 release, thank you!

Show
Elliot Metsger added a comment - Prepending the Project's baseDir to the resource directory (if the resource directory is not absolute) fixed this issue. Attached is a patch. Please review and consider for the 2.0.2 release, thank you!
Hide
Elliot Metsger added a comment -

May want to take out the System.out.println in my patch... forgot to clean that up, sorry about that.

Show
Elliot Metsger added a comment - May want to take out the System.out.println in my patch... forgot to clean that up, sorry about that.
Hide
Milos Kleint added a comment -

MWAR-77 might be a duplicate of this one. MRESOURCES-32 also related

Show
Milos Kleint added a comment - MWAR-77 might be a duplicate of this one. MRESOURCES-32 also related
Hide
Elliot Metsger added a comment -

MWAR-79 duplicates MWAR-77. MWAR-79 has a test project and patch attached to it.

Show
Elliot Metsger added a comment - MWAR-79 duplicates MWAR-77. MWAR-79 has a test project and patch attached to it.
Hide
Alexander Syedin added a comment -

As workaround directory could be referenced using ${basedir} property:
<directory>${basedir}/src/main/resources</directory>
instead of
<directory>src/main/resources</directory>

Show
Alexander Syedin added a comment - As workaround directory could be referenced using ${basedir} property: <directory>${basedir}/src/main/resources</directory> instead of <directory>src/main/resources</directory>
Hide
Stephane Nicoll added a comment -

Applied, thanks.

Show
Stephane Nicoll added a comment - Applied, thanks.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: