Uploaded image for project: 'Maven WAR Plugin'
  1. Maven WAR Plugin
  2. MWAR-224

Running web build from a parent modular pom fails when filtering resources

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.1-beta-1
    • None
    • filtering
    • None

    Description

      Running mvn clean install from the parent directory fails with the following debug output:

      [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-war-plugin:2.1-beta-1:war' -->
      [DEBUG]   (s) archiveClasses = false
      [DEBUG]   (s) attachClasses = false
      [DEBUG]   (s) cacheFile = C:\development\eclipse-workspaces\default\gs-web\target\war\work\webapp-cache.xml
      [DEBUG]   (s) classesClassifier = classes
      [DEBUG]   (s) classesDirectory = C:\development\eclipse-workspaces\default\gs-web\target\classes
      [DEBUG]   (f) escapedBackslashesInFilePath = false
      [DEBUG]   (s) failOnMissingWebXml = true
      [DEBUG]   (f) filteringDeploymentDescriptors = false
      [DEBUG]   (s) filters = [src/main/filters/application.properties]
      [DEBUG]   (s) outputDirectory = C:\development\eclipse-workspaces\default\gs-web\target
      [DEBUG]   (s) primaryArtifact = true
      [DEBUG]   (s) project = MavenProject: com.rob.gs:gs-web:0.0.1-SNAPSHOT @ C:\development\eclipse-workspaces\default\gs-web\pom.xml
      [DEBUG]   (f) session = org.apache.maven.execution.MavenSession@7c3885
      [DEBUG]   (s) useCache = true
      [DEBUG]   (s) warName = gs-web-0.0.1-SNAPSHOT
      [DEBUG]   (s) warSourceDirectory = C:\development\eclipse-workspaces\default\gs-web\src\main\webapp
      [DEBUG]   (s) directory = src/main/filtered-resources
      [DEBUG]   (s) targetPath = WEB-INF
      [DEBUG]   (s) filtering = true
      [DEBUG]   (s) includes = [**/*.xml]
      [DEBUG]   (s) webResources = [Resource {targetPath: WEB-INF, filtering: true, FileSet {directory: src/main/filtered-resources, PatternSet [includes: {**/*.xml}, excludes: {}]}}]
      [DEBUG]   (s) webappDirectory = C:\development\eclipse-workspaces\default\gs-web\target\gs-web-0.0.1-SNAPSHOT
      [DEBUG]   (s) workDirectory = C:\development\eclipse-workspaces\default\gs-web\target\war\work
      [DEBUG] -- end configuration --
      [INFO] [war:war {execution: default-war}]
      [INFO] Packaging webapp
      [INFO] Assembling webapp[gs-web] in [C:\development\eclipse-workspaces\default\gs-web\target\gs-web-0.0.1-SNAPSHOT]
      [ERROR] fail to build filering wrappers Error loading property file 'src/main/filters/application.properties'
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Error loading property file 'src/main/filters/application.properties'
      
      src\main\filters\application.properties
      [INFO] ------------------------------------------------------------------------
      [DEBUG] Trace
      org.apache.maven.lifecycle.LifecycleExecutionException: Error loading property file 'src/main/filters/application.properties'
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      	at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
      	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:597)
      	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)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Error loading property file 'src/main/filters/application.properties'
      	at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:450)
      	at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:394)
      	at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:195)
      	at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:157)
      	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      	... 17 more
      Caused by: org.apache.maven.shared.filtering.MavenFilteringException: Error loading property file 'src/main/filters/application.properties'
      	at org.apache.maven.shared.filtering.DefaultMavenFileFilter.loadProperties(DefaultMavenFileFilter.java:265)
      	at org.apache.maven.shared.filtering.DefaultMavenFileFilter.getDefaultFilterWrappers(DefaultMavenFileFilter.java:143)
      	at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:442)
      	... 22 more
      Caused by: java.io.FileNotFoundException: src\main\filters\application.properties
      	at org.apache.maven.shared.filtering.PropertyUtils.loadPropertyFile(PropertyUtils.java:65)
      	at org.apache.maven.shared.filtering.DefaultMavenFileFilter.loadProperties(DefaultMavenFileFilter.java:260)
      	... 24 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 8 seconds
      [INFO] Finished at: Tue Apr 27 17:12:34 BST 2010
      [INFO] Final Memory: 37M/92M
      [INFO] ------------------------------------------------------------------------
      

      Running the same command from the project directory itself works without issue:

      [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-war-plugin:2.1-beta-1:war' -->
      [DEBUG]   (s) archiveClasses = false
      [DEBUG]   (s) attachClasses = false
      [DEBUG]   (s) cacheFile = C:\development\eclipse-workspaces\default\gs-web\target\war\work\webapp-cache.xml
      [DEBUG]   (s) classesClassifier = classes
      [DEBUG]   (s) classesDirectory = C:\development\eclipse-workspaces\default\gs-web\target\classes
      [DEBUG]   (f) escapedBackslashesInFilePath = false
      [DEBUG]   (s) failOnMissingWebXml = true
      [DEBUG]   (f) filteringDeploymentDescriptors = false
      [DEBUG]   (s) filters = [src/main/filters/application.properties]
      [DEBUG]   (s) outputDirectory = C:\development\eclipse-workspaces\default\gs-web\target
      [DEBUG]   (s) primaryArtifact = true
      [DEBUG]   (s) project = MavenProject: com.rob.gs:gs-web:0.0.1-SNAPSHOT @ C:\development\eclipse-workspaces\default\gs-web\pom.xml
      [DEBUG]   (f) session = org.apache.maven.execution.MavenSession@1cf7491
      [DEBUG]   (s) useCache = true
      [DEBUG]   (s) warName = gs-web-0.0.1-SNAPSHOT
      [DEBUG]   (s) warSourceDirectory = C:\development\eclipse-workspaces\default\gs-web\src\main\webapp
      [DEBUG]   (s) directory = src/main/filtered-resources
      [DEBUG]   (s) targetPath = WEB-INF
      [DEBUG]   (s) filtering = true
      [DEBUG]   (s) includes = [**/*.xml]
      [DEBUG]   (s) webResources = [Resource {targetPath: WEB-INF, filtering: true, FileSet {directory: src/main/filtered-resources, PatternSet [includes: {**/*.xml}, excludes: {}]}}]
      [DEBUG]   (s) webappDirectory = C:\development\eclipse-workspaces\default\gs-web\target\gs-web-0.0.1-SNAPSHOT
      [DEBUG]   (s) workDirectory = C:\development\eclipse-workspaces\default\gs-web\target\war\work
      [DEBUG] -- end configuration --
      [INFO] [war:war {execution: default-war}]
      [INFO] Packaging webapp
      [INFO] Assembling webapp[gs-web] in [C:\development\eclipse-workspaces\default\gs-web\target\gs-web-0.0.1-SNAPSHOT]
      [DEBUG] properties used {java.vendor=Sun Microsystems Inc., env.SYSTEMROOT=C:\Windows, sun.java.launcher=SUN_STANDARD, env.TRACE_FORMAT_SEARCH_PATH=\\NTREL202.ntdev.corp.microsoft.com\4F18C3A5-CA09-4DBD-B6FC-219FDD4C6BE0\TraceFormat, sun.management.compiler=HotSpot Client 
      .
      .
      .
      

      Configuration in pom.xml is:

      <plugin>
      	<artifactId>maven-war-plugin</artifactId>
      	<version>2.1-beta-1</version>
      	<configuration>
      		<filters>
      			<filter>src/main/filters/application.properties</filter>
      		</filters>
      		<webResources>
      			<resource>
      				<!-- this is relative to the pom.xml directory -->
      				<directory>src/main/filtered-resources</directory>
      				<!-- override the destination directory for this resource -->
      				<targetPath>WEB-INF</targetPath>
      				<!-- Enable Filtering -->
      				<filtering>true</filtering>
      				<!-- Include xml files -->
      				<includes>
      					<include>**/*.xml</include>
      				</includes>
      			</resource>
      		</webResources>
      	</configuration>
      </plugin>
      

      Pom in parent dir looks like this:

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.rob</groupId>
        <artifactId>gs</artifactId>
        <packaging>pom</packaging>
        <name>Module Build</name>
        <version>0.0.1-SNAPSHOT</version>
        <modules>
        	<module>gs-model</module>
        	<module>gs-interfaces</module>
        	<module>gs-web</module>
        </modules>
      </project>
      

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            jameskavanagh James Kavanagh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment