[ https://jira.codehaus.org/browse/MRESOURCES-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=293614#comment-293614 ]
Laurent Malvert edited comment on MRESOURCES-160 at 3/7/12 7:57 PM: -------------------------------------------------------------------- Might be more an enhancement than a bug as the [goal's documentation|http://maven.apache.org/plugins/maven-resources-plugin/copy-resources-mojo.html] indicates that this is a required parameter. So it appears the the documentation on the maven site is wrong (actually, mayve it's just badly worded: {quote} [...] The default directory for a build is {{$\{basedir\}/src/main/resources}}. {quote} Maybe the intent was to say that this is where resources are usually located, not exactly that the default value for {{directory}} is supposed to be this. However, it shouldn't really fail with an NPE without giving any helpful information. **Careful:** in my ticket above I mention {{outputDirectory}}. Obviously I meant {{directory}}, as shown in the example project's configuration. Sorry for the confusion. was (Author: laurent.malvert): Might be more an enhancement than a bug as the [goal's documentation|http://maven.apache.org/plugins/maven-resources-plugin/copy-resources-mojo.html] indicates that this is a required parameter. So it appears the the documentation on the maven site is wrong (actually, mayve it's just badly worded: {quote} [...] The default directory for a build is {{$\{basedir\}/src/main/resources}}. {quote} Maybe the intent was to say that this is where resources are usually located, not exactly that the default value for {{directory}} is supposed to be this. However, it shouldn't really fail with an NPE without giving any helpful information. > 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