You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Christophe Jolif <cj...@ilog.fr> on 2003/05/06 19:10:44 UTC

resources:copy and reactor problem

Hi all!

Let me first explain my problem,

My specialized plugin is launching the build of other (sub-)projects from a 
main project.xml using reactor is a way similar to the following:

   <goal name='myplugin:build'>
      <!-- java:jar for the main project -=->
      <attainGoal name='java:jar'/>
      <m:reactor
        basedir='${basedir}/${myplugin.sub.dir}'
        postProcessing='false'
        includes='*/project.xml'
        goals='java:jar'
        banner='java:jar'
        ignoreFailures='false'/>
    </goal>

ok, everything is working fine for most of the sub-projects but it is
failing for the ones that don't have a resources directory with the following
error:

file:/d:/users/jolif/Dev/maven/plugins/myplugin/myplugin.jelly
:28:31: <m:reactor> Unable to obtain goal [java:jar-resources] -- null:74:46:
<copy> D:\Users\Jolif\Dev\project\extensions\subproject1\src\resources not found.

I investigated a little bit and it seems to me I found the origin of the problem.

The java:jar-resources task is calling the resources:copy taks that is doing 
the following check to verify whether or not the directory is present before 
trying to copying it with the ant copy task:

<j:set var="resourceDirectoryPresent" value="false"/>

<util:available file="${resource.directory}">
    <j:set var="resourceDirectoryPresent" value="true"/>
</util:available>

and then the same ${resource.directory} variable is used in an ant copy task.

I think the problem come from the fact that there is a discrepency here 
between the two. Indeed that ant task will take that ${resource.directory} 
relatively to the Project ${base.dir} as ant is always (as far as I know) 
resolving the path with that valu. At the same time util:available will build 
a File() from it (using the beanutils FileConverter) and so take it relatively 
to the current user directory (which is the way new File("foo") works) which 
in this case are different (one is 'project' this other one 
'project/extensions/subproject1'). So we end up testing the availability of 
resources in the father project not in the sub-projects.

Did I miss something? As far as I can see there's several way to fix that but 
replacing  <util:available file="${resource.directory}"> by <util:available 
file="${basedir}/${resource.directory}"> in conf/driver.jelly should do the 
trick? Another solution would be to change the current user directory when 
running the reactor.

Thanks confirming or not my analysis and if it is a bug if you intend to fix 
it (or how to solve my problem if it is not :-).

-- 
Christophe



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org