You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Barry Kaplan <gr...@memelet.com> on 2005/11/04 01:42:11 UTC

eclipse:eclipse and direct project references

In the eclipse plugin, EclipseUtils.findReactorProject() does the below 
snippet when deciding whether a reactor project matches a dependency 
artifact (and if so, a direct eclipse project dependency is created 
instead of a repo jar depenency):

            if ( project.getGroupId().equals( artifact.getGroupId() )
                && project.getArtifactId().equals( 
artifact.getArtifactId() )
                && project.getVersion().equals( artifact.getVersion() ) )
            {
                return project;
            }

However, when working with SNAPSHOT, the project version will be, eg 
"1.0-SNAPSHOT" where the actual artifact dependency will be eg 
"1.0-20051103.223110-12". Hence they will never match, even though the 
dated version does indeed correspond to the snapshot.

Is this a bug, or is there something else I am not understanding?

-barry


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


Re: eclipse:eclipse and direct project references

Posted by Barry Kaplan <gr...@memelet.com>.
Ok, I've got direct eclipse project references now. The procedure below 
worked perfectly. Thanks!!

-barry

Barry Kaplan wrote:

> Mark Hobson wrote:
>
>> (Project A depends on project B; both SNAPSHOT versions; all mvn
>> commands done in reactor build)
>>
>> * Delete A and B from local repo
>> * mvn install - SNAPSHOT jars created in local repo
>> * mvn eclipse:eclipse - project references created
>> * Delete B from local repo
>> * mvn install - B SNAPSHOT downloaded from continuum
>> * mvn eclipse:eclipse - jar references created
>> * mvn install
>> * mvn eclipse:eclipse - project references created
>>
>
> Hmm, this would be exactly what I want, if this is what how it works. 
> But I'm not seeing this behavior. I'm seeing "SNAPHOT' for A being 
> compared to  the timestamp for B. But I will try again later today. 
> Maybe I did the 'mvn eclipse:eclipse' before the 'install'.
>
> -barry
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>


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


Re: eclipse:eclipse and direct project references

Posted by Barry Kaplan <gr...@memelet.com>.
Mark Hobson wrote:

>(Project A depends on project B; both SNAPSHOT versions; all mvn
>commands done in reactor build)
>
>* Delete A and B from local repo
>* mvn install - SNAPSHOT jars created in local repo
>* mvn eclipse:eclipse - project references created
>* Delete B from local repo
>* mvn install - B SNAPSHOT downloaded from continuum
>* mvn eclipse:eclipse - jar references created
>* mvn install
>* mvn eclipse:eclipse - project references created
>

Hmm, this would be exactly what I want, if this is what how it works. 
But I'm not seeing this behavior. I'm seeing "SNAPHOT' for A being 
compared to  the timestamp for B. But I will try again later today. 
Maybe I did the 'mvn eclipse:eclipse' before the 'install'.

-barry

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


Re: eclipse:eclipse and direct project references

Posted by Mark Hobson <ma...@gmail.com>.
On 04/11/05, Kenney Westerhof <ke...@apache.org> wrote:
> Sorry guys, but I closed the issue with a "Won't fix",
> see http://jira.codehaus.org/browse/MNG-1410 for an explanation.
>
> Should you really have a good reason this is a bug/improvement,
> NOT breaking maven 2's dependency handling, you can reopen it.

Thanks for clarifying Kenney, makes sense.  I've just retried my steps
here and it seems to correlate.  If anyone's interested, it works like
this:

(Project A depends on project B; both SNAPSHOT versions; all mvn
commands done in reactor build)

* Delete A and B from local repo
* mvn install - SNAPSHOT jars created in local repo
* mvn eclipse:eclipse - project references created
* Delete B from local repo
* mvn install - B SNAPSHOT downloaded from continuum
* mvn eclipse:eclipse - jar references created
* mvn install
* mvn eclipse:eclipse - project references created

Cheers,

Mark

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


Re: eclipse:eclipse and direct project references

Posted by Kenney Westerhof <ke...@apache.org>.
On Fri, 4 Nov 2005, Mark Hobson wrote:

Sorry guys, but I closed the issue with a "Won't fix",
see http://jira.codehaus.org/browse/MNG-1410 for an explanation.

Should you really have a good reason this is a bug/improvement,
NOT breaking maven 2's dependency handling, you can reopen it.

-- Kenney

> Hi Barry,
>
> I noticed this yesterday too and raised an issue:
> http://jira.codehaus.org/browse/MNG-1410
>
> You may want to supply patches there.
>
> Cheers,
>
> Mark
>
> On 04/11/05, Barry Kaplan <gr...@memelet.com> wrote:
> > Below is what I did to get a proper project to be created. Now I don't
> > really understand how snapshots are supposed to work, so I'm sure there
> > are problems with this solution. But at least it is creating proper
> > eclipse projects. Now I need to learn how to make a custom verson of a
> > plugin available to my team..........
> >
> >     public static MavenProject findReactorProject( List reactorProjects,
> > Artifact artifact )
> >     {
> >         if ( reactorProjects == null )
> >         {
> >             return null; // we're a single project
> >         }
> >
> >         for ( Iterator it = reactorProjects.iterator(); it.hasNext(); )
> >         {
> >             MavenProject project = (MavenProject) it.next();
> >
> >             if ( project.getGroupId().equals( artifact.getGroupId() )
> >                 && project.getArtifactId().equals(
> > artifact.getArtifactId() )
> >                 && isVersionMatch(project, artifact) )
> >                 //project.getVersion().equals( artifact.getVersion() ) )
> >             {
> >                 return project;
> >             }
> >         }
> >
> >         return null;
> >     }
> >
> >     public static boolean isVersionMatch(MavenProject project, Artifact
> > artifact) {
> >         return project.getVersion ().equals(artifact.getVersion())
> >                 ||
> > project.getVersion().equals(artifact.getVersionRange().toString());
> >     }
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

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


Re: eclipse:eclipse and direct project references

Posted by Mark Hobson <ma...@gmail.com>.
Hi Barry,

I noticed this yesterday too and raised an issue:
http://jira.codehaus.org/browse/MNG-1410

You may want to supply patches there.

Cheers,

Mark

On 04/11/05, Barry Kaplan <gr...@memelet.com> wrote:
> Below is what I did to get a proper project to be created. Now I don't
> really understand how snapshots are supposed to work, so I'm sure there
> are problems with this solution. But at least it is creating proper
> eclipse projects. Now I need to learn how to make a custom verson of a
> plugin available to my team..........
>
>     public static MavenProject findReactorProject( List reactorProjects,
> Artifact artifact )
>     {
>         if ( reactorProjects == null )
>         {
>             return null; // we're a single project
>         }
>
>         for ( Iterator it = reactorProjects.iterator(); it.hasNext(); )
>         {
>             MavenProject project = (MavenProject) it.next();
>
>             if ( project.getGroupId().equals( artifact.getGroupId() )
>                 && project.getArtifactId().equals(
> artifact.getArtifactId() )
>                 && isVersionMatch(project, artifact) )
>                 //project.getVersion().equals( artifact.getVersion() ) )
>             {
>                 return project;
>             }
>         }
>
>         return null;
>     }
>
>     public static boolean isVersionMatch(MavenProject project, Artifact
> artifact) {
>         return project.getVersion ().equals(artifact.getVersion())
>                 ||
> project.getVersion().equals(artifact.getVersionRange().toString());
>     }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: eclipse:eclipse and direct project references

Posted by Barry Kaplan <gr...@memelet.com>.
Below is what I did to get a proper project to be created. Now I don't 
really understand how snapshots are supposed to work, so I'm sure there 
are problems with this solution. But at least it is creating proper 
eclipse projects. Now I need to learn how to make a custom verson of a 
plugin available to my team..........

    public static MavenProject findReactorProject( List reactorProjects, 
Artifact artifact )
    {
        if ( reactorProjects == null )
        {
            return null; // we're a single project
        }

        for ( Iterator it = reactorProjects.iterator(); it.hasNext(); )
        {
            MavenProject project = (MavenProject) it.next();

            if ( project.getGroupId().equals( artifact.getGroupId() )
                && project.getArtifactId().equals( 
artifact.getArtifactId() )
                && isVersionMatch(project, artifact) )
                //project.getVersion().equals( artifact.getVersion() ) )
            {
                return project;
            }
        }

        return null;
    }
    
    public static boolean isVersionMatch(MavenProject project, Artifact 
artifact) {
        return project.getVersion ().equals(artifact.getVersion())
                || 
project.getVersion().equals(artifact.getVersionRange().toString());
    }


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