maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Mickelson <>
Subject Re: Maven Project - in repository or in current modular project
Date Wed, 02 Nov 2011 11:04:08 GMT
Thanks a million, as I said, now I will as soon as I have time study 
this suggestion and when I have resolved my issue I will give my 
version here for future users with similar problems.

On mercoledì 2 novembre 2011 11.46.21, Stephen Connolly wrote:
>      /**
>       * @parameter expression="${reactorProjects}"
>       * @required
>       * @readonly
>       */
>      private List/*<MavenProject>*/ reactorProjects;
> will in your mojo will give you the list of reactor projects (if
> targetting JRE 1.5+ you can safely uncomment the generics qualifier)
> for (MavenProject project: reactorProjects) {
>    if (project.getGroupId().equals(groupId)&&
> project.getArtifactId().equals(artifactId)&&
> project.getVersion().equals(version)) {
>      for (Artifact artifact: project.getAttachedArtifacts() {
>        if (artifact.getClassifier().equals(classifier)&&
> artifact.getType().equals(type)) {
>          return artifact.getFile();
>      }
>    }
> }
> return null;
> If you get a null file back or if the file does not exist.... fall
> back to resolving from the local/remote repos
> On 2 November 2011 09:52, Tim Mickelson<>  wrote:
>>    Thanks, I think I've understood your strategy, that immediately brings me
>> to the problem that I'm lacking documentation. Could you please give me an
>> simple example how to do this, at least the two most important passes and I
>> should be on a go I think :)
>>    Of course if I resolve my problem then I will give an exhausted
>> explanation how I went about it so that future users searching this thread
>> see me through.
>>    Tim
>> On 02/11/2011 10.15, Stephen Connolly wrote:
>> On 2 November 2011 09:06, Tim Mickelson<>  wrote:
>>   I want to write a plugin to maven that copies the flex modules from a flex
>> project (type swf) which contains modules. This  because the flexmojos does
>> not do this. My problem is that independent of how the flexmodules are
>> configured in the pom of the flex project they are saved on the local
>> repository with a naming convention using artifactId, version and the name
>> in lowercase as configured in the pom.
>>   I need to copy them as configured in the pom. Well, actually this is not a
>> great problem, just some manipulation extracting information from the pom
>> and I'm done. The problem is, that when flex project is in some way part of
>> my project (modular) then the files are not saved with this convention but
>> in the path as configured in the pom and with the name as configured in the
>> pom.
>>   I would like to know, how I can distinguish if the swf project that I have
>> at hand is in the repository, because it was previously installed or if it
>> is part of my current project. I don't know if I've explained myself well,
>> with being in my current project I mean specifically the case in which I
>> have a pom that has e.g. two modules, one for the swf, and then one war
>> where I want to put the peaces together.
>> You should be looking for the references to the files from the
>> reactor's attached artifacts not on the disk directly, so you'd
>> iterate through the reactorProjects looking for the one with the
>> matching GAV, if present then you look at that project's attached
>> artifacts for the matching GAVCT and if the getFile() != null then
>> that is your file. Otherwise if you have not found the file, then hit
>> the repositories.
>> That is the _correct_ way in principle....
>> What I cannot recall is if there are some handy helper methods/utility
>> classes to do just that for you or whether you have to reinvent the
>> wheel each time
>> -Stephen
>>   Any link to documentation is welcome, all I can find is to simple from e.g.
>> the maven site or the complete guide.
>>   Tim
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message