maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Glauche (JIRA)" <j...@codehaus.org>
Subject [jira] Commented: (MWAR-246) NullPointerException Processing Web Resources
Date Mon, 21 Feb 2011 21:51:22 GMT

    [ http://jira.codehaus.org/browse/MWAR-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=257106#action_257106
] 

Michael Glauche commented on MWAR-246:
--------------------------------------

QnD patch:

{code}
Index: src/main/java/org/apache/maven/plugin/war/packaging/WarProjectPackagingTask.java
===================================================================
--- src/main/java/org/apache/maven/plugin/war/packaging/WarProjectPackagingTask.java	(revision
1072684)
+++ src/main/java/org/apache/maven/plugin/war/packaging/WarProjectPackagingTask.java	(working
copy)
@@ -121,6 +121,11 @@
         for ( int i = 0; i < webResources.length; i++ )
         {
             Resource resource = webResources[i];
+            
+            if (resource.getDirectory() == null) {
+                throw new MojoExecutionException( "Directory tag is missing from Resource
decleration" );
+            }
+            
             if ( !( new File( resource.getDirectory() ) ).isAbsolute() )
             {
                 resource.setDirectory( context.getProject().getBasedir() + File.separator
+ resource.getDirectory() );
{code}

Although http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html
does state the following example:

{code}
        ...
        <configuration>
          <webResources>
            <resource>
              <!-- the default value is ** -->
              <includes>
                <include>**/pattern1</include>
                <include>*pattern2</include>
              <includes>
              <!-- there's no default value for this -->
              <excludes>
                <exclude>*pattern3/pattern3</exclude>
                <exclude>pattern4/pattern4</exclude>
              </excludes>
            </resource>
          </webResources>
        </configuration>
        ...
{code}

Which does give a NPE in any case with maven-war-plugin 2.1.1, i think the example should
also contain a directory tag, or ?

> NullPointerException Processing Web Resources
> ---------------------------------------------
>
>                 Key: MWAR-246
>                 URL: http://jira.codehaus.org/browse/MWAR-246
>             Project: Maven 2.x WAR Plugin
>          Issue Type: Bug
>    Affects Versions: 2.1.1
>         Environment: Linux, JDK 6
>            Reporter: Gary Murphy
>             Fix For: 2.2
>
>
> NullPointerException on packaging of web resources.  Configuration is:
>          <plugin>
>             <artifactId>maven-war-plugin</artifactId>
>             <configuration>
>                <webResources>
>                   <resource>
> 	                  <excludes>
> 	                     <exclude>xercesImpl-*.jar</exclude>
> 	                  </excludes>
>                   </resource>
>                </webResources>
>             </configuration>
>          </plugin>
> Stack trace is:
> Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war failed.
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:140)
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
> 	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
> 	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316)
> 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
> 	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:451)
> 	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:188)
> 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:134)
> 	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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-war of
goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war failed.
> 	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:116)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:195)
> 	... 19 more
> Caused by: java.lang.NullPointerException
> 	at java.io.File.<init>(File.java:222)
> 	at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.handleWebResources(WarProjectPackagingTask.java:124)
> 	at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.performPackaging(WarProjectPackagingTask.java:91)
> 	at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:472)
> 	at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:404)
> 	at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:197)
> 	at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:159)
> 	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
> 	... 20 more

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message