[ 
https://jira.codehaus.org/browse/MRESOURCES-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=293615#comment-293615
 ] 

Laurent Malvert commented on MRESOURCES-160:
--------------------------------------------

Hmmm, I just realized these aren't exactly the same. I followed the goal's 
documentation, which then documented the {{<resources>}} by saying to look it 
up in the Maven Model documentation, and I ended up there, and somehow got 
mixed up between the {{<outputdirectory>}} and {{<directory>}}.

Nonetheless, the NPE seems like a pretty harsh default behavior and should 
provide additional information (missing required path).

Sorry for the confusion (would be worth testing if {{<targetPath>}} suffers 
from the same issue.

                
> NPE when copy-resources set to use the default <outputDirectory> as 
> aspecified by documentation
> -----------------------------------------------------------------------------------------------
>
>                 Key: MRESOURCES-160
>                 URL: https://jira.codehaus.org/browse/MRESOURCES-160
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>          Components: copy
>    Affects Versions: 2.5
>         Environment: Windows 7 64 bits
> Java 1.6.0_31 x64
> maven 3.0.4
>            Reporter: Laurent Malvert
>         Attachments: error.log, resources-npe.tar.gz
>
>
> h2. Context and Issue
> When using the {{maven-resources-plugin}} to copy a resource to a custom 
> directory using the {{copy-resources}} goal, it triggers an NPE without any 
> additional information when the {{<outputDirectory>}} element is not 
> specified:
> {noformat}
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-resources-plugin:2.5:copy-resources 
> (copy-resources) on project NPEResourcesBug: Execution copy-resources of goal 
> org.apache.maven.plugins:maven-resources-plugin:2.5:copy-resources failed. 
> NullPointerException -> [Help 1]
> {noformat}
> However, the documentation at: http://maven.apache.org/pom.html#Resources
> clearly states:
> {quote}
> directory: This element's value defines where the resources are to be found. 
> The default directory for a build is ${basedir}/src/main/resources.
> {quote}
> Specifying it explictly with this value works as intended.
> _(Not sure if relevant to maven-resources-plugin or the MSHARED resources 
> component?)_
> h2. Test Case
> Or at leat a project to reproduce.
> See the attached project for a working test case, which uses this 
> configuration:
> {code}
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-resources-plugin</artifactId>
>                 <version>2.5</version>
>                 <executions>
>                     <execution>
>                         <id>copy-resources</id>
>                         <phase>validate</phase>
>                         <goals>
>                             <goal>copy-resources</goal>
>                         </goals>
>                         <configuration>
>                             <outputDirectory>
>                                 ${basedir}/resources
>                             </outputDirectory>
>                             <resources>     
>                                 <resource>
>                                     <!--
>                                         works when included explictly set,
>                                         NPE otherwise, though documentation 
> at:
>                                         
> http://maven.apache.org/pom.html#Resources
>                                         really mentions:
>                                         "directory: This element's
>                                         value defines where the
>                                         resources are to be found. The
>                                         default directory for a build
>                                         is
>                                         ${basedir}/src/main/resources."
>                                     -->
>                                     <!--
>                                     
> <directory>${basedir}/src/main/resources</directory>
>                                     -->
>                                     <includes>
>                                         <include>**/somefile.xml</include>
>                                     </includes>
>                                 </resource>
>                             </resources>              
>                         </configuration>            
>                     </execution>
>                 </executions>
>             </plugin>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to