Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Maven Integration (M2E) » new project - APIs for m2eclipse
new project - APIs for m2eclipse [message #948] Thu, 17 April 2008 03:29 Go to next message
Eclipse UserFriend
Originally posted by: oleg.subscriptions.gmail.com

I think it will be highly unfair to have such a wonderful product as
m2eclipse and having to know all nitty-gritty details of Maven and Eclipse
in order to use it programmatically from other bundles/components.

In order to simplify things, James Ervin and I started another project -
very closely related to m2eclipse - m2eclipse APIs. The purpose - is to
ease programmer's access to the Maven universe. For now we came from our
immediate needs - necessity to find an Artifact, find all Artifact
dependencies as a resolved scoped classpath or mavenize an Eclipse project.

SVN repository is at http://svn.sonatype.org/m2eclipse/branches/api/ and
is tightly coupled with m2eclipse version. Current version 1.0.8 has been
tested with m2e 0.9.2 One of the projects there -
org.maven.ide.eclipse.api.test - shows how to use it from another bundle
(TestHandler.java). Usage is very simplistic:

MavenEclipseApi mavenApi =
(MavenEclipseApi)MavenApiPlugin.getDefault().getMavenEclipse Api();
mavenApi.[API call here] ...

Update site is available at:
http://svn.sonatype.org/m2eclipse/branches/api/org.maven.ide .eclipse.api.site/

It would be awesome to hear comments - what kind of functionality is
interesting for users.

What we have now is a flat list of calls. Please note - not all of them
work, so it's more of a prototype that a stable product. But we are
dedicated to deliver it :)

//---------------------------------------------------------- -----------
/**
* read & parse the POM file from an IProject
*/
public Model parsePom( final IProject project )
throws MavenApiException;
//---------------------------------------------------------- -----------
/**
* read & parse the POM file from an IFile
*/
public Model parsePom( final IFile file )
throws MavenApiException;
//---------------------------------------------------------- -----------
/**
* read & parse the POM file from a real File.
* <b>Please use with caution: this is not thread-safe call!! </b>
*/
public Model parsePom( final File file )
throws MavenApiException;
//---------------------------------------------------------- -----------
/**
* return local repository
*/
public ArtifactRepository localRepository() throws MavenApiException;
//---------------------------------------------------------- -----------
/**
* take existing Eclipse project and mavenize it with the supplied
model
*/
public abstract IProject mavenizeProject( final
ProjectMavenizationRequest req )
throws MavenEclipseApiException
;
//---------------------------------------------------------- -----------
public abstract Artifact resolveArtifact( final ArtifactMetadata md )
throws MavenApiException
;

//---------------------------------------------------------- ---------------------------
public abstract MetadataTreeNode resolveArtifactMetadataAsTree(
ArtifactMetadata md
)
throws MavenApiException
;

//---------------------------------------------------------- ---------------------------
public abstract MavenProject resolveArtifactAsProject( final Artifact
artifact )
throws MavenApiException
;

//---------------------------------------------------------- ---------------------------
public abstract MetadataGraph resolveArtifactAsScopeGraph( final
ArtifactMetadata md )
throws MavenApiException
;

//---------------------------------------------------------- ---------------------------
public abstract List<Artifact> resolveArtifactAsClasspath( final
ArtifactMetadata md )
throws MavenApiException
;
public Artifact resolveArtifact( final Artifact artifact )
throws MavenApiException;

//---------------------------------------------------------- ---------------------------
public abstract Collection<Artifact> findGroup( String groupRegEx )
throws MavenApiException
;

//---------------------------------------------------------- ---------------------------
public abstract Collection<Artifact> findArtifact( String query )
throws MavenApiException
;
Re: new project - APIs for m2eclipse [message #981 is a reply to message #948] Thu, 17 April 2008 04:44 Go to previous messageGo to next message
Mark Diggory is currently offline Mark DiggoryFriend
Messages: 13
Registered: July 2009
Junior Member
Congrats,

I look forward to seeing a greater synergy between Maven and Eclipse. I'll
look for avenues for my own involvement. Keep up the good work

Cheers,
Mark Diggory
Re: new project - APIs for m2eclipse [message #1037 is a reply to message #981] Thu, 17 April 2008 14:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: oleg.subscriptions.gmail.com

Mark,

Don't hesitate to jump in. As I mentioned in the posting - it resulted
from internal needs and has a tendency to only reflect those needs.

To make it interesting for others to use - we need diversity. For
instance - we dive deeply into dependency management and finding
artifacts. But what about changing project characteristics, like
managing properties and profiles, conversion from binary dependencies to
source projects and vise versa? Programatically that is. Any interest there?

Thanks,
Oleg Gusakov
Re: new project - APIs for m2eclipse [message #1066 is a reply to message #1037] Thu, 17 April 2008 15:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tida.apa.gmail.com

Is there any documentation available (wiki)?
Re: new project - APIs for m2eclipse [message #1092 is a reply to message #1066] Thu, 17 April 2008 16:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: oleg.subscriptions.gmail.com

Today - no :(

There a sample usage in the test plugin project:

MavenEclipseApi mavenApi =
(MavenEclipseApi)MavenApiPlugin.getDefault().getMavenEclipse Api();
mavenApi.[API call here] ...

API calls are listed in the initial posting.

But it's a very good point - cannot turn prototype into a product
without docs and issue tracking. We will do that, most probably -
publish a Maven site for it.

Thank you for the comment!
Re: public APIs for m2eclipse [message #1117 is a reply to message #948] Thu, 17 April 2008 16:44 Go to previous messageGo to next message
Eugene Kuleshov is currently offline Eugene KuleshovFriend
Messages: 504
Registered: July 2009
Senior Member
To clarify, this exercise was initially started to abstract
integrators from changes in m2eclipse APIs.

However we have been working towards stabilizing public API exposed
by m2eclipse core. There are number of things exposed to integrators
and we are looking for feedback on those and make them generally more
usable for integrations.
Also note that there are some extension points exposed by m2eclipse.
Documentation for those is on the wiki
http://docs.codehaus.org/display/M2ECLIPSE/Extension+Points

All public API is accessible trough MavenPlugin instance that you can
obtain using MavenPlugin.getDefault(). Then following methods of
MavenPlugin provide access to public services:

getConsole()
getMavenModelManager()
getMavenProjectManager()
getMavenEmbedderManager()
getIndexManager()
getBuildpathManager()
getMavenRuntimeManager()
getArchetypeManager()

Note that Maven's org.apache.maven.model.Model class is not very
useful for Maven pom manipulation. So, MavenModelManager provides more
advanced abstraction for pom editing and refactoring. See
MavenModelManager.updateProject(IFile pomFile, ProjectUpdater updater)
as well as ProjectDocument and ProjectUpdater interface.

All in all, this is still work in progress and we will be reiterating
trough public API before 1.0 release. If you have particular ideas or
specific integration needs, please add them to the wiki page at
http://docs.codehaus.org/display/M2ECLIPSE/Other+Ideas+and+U se+Cases

regards,
Eugene


Oleg Gusakov wrote:
> I think it will be highly unfair to have such a wonderful product as
> m2eclipse and having to know all nitty-gritty details of Maven and
> Eclipse in order to use it programmatically from other
> bundles/components.
>
> In order to simplify things, James Ervin and I started another project
> - very closely related to m2eclipse - m2eclipse APIs. The purpose - is
> to ease programmer's access to the Maven universe. For now we came
> from our immediate needs - necessity to find an Artifact, find all
> Artifact dependencies as a resolved scoped classpath or mavenize an
> Eclipse project.
>
> SVN repository is at http://svn.sonatype.org/m2eclipse/branches/api/
> and is tightly coupled with m2eclipse version. Current version 1.0.8
> has been tested with m2e 0.9.2 One of the projects there -
> org.maven.ide.eclipse.api.test - shows how to use it from another
> bundle (TestHandler.java). Usage is very simplistic:
>
> MavenEclipseApi mavenApi =
> (MavenEclipseApi)MavenApiPlugin.getDefault().getMavenEclipse Api();
> mavenApi.[API call here] ...
>
> Update site is available at:
> http://svn.sonatype.org/m2eclipse/branches/api/org.maven.ide .eclipse.api.site/
>
>
> It would be awesome to hear comments - what kind of functionality is
> interesting for users.
>
> What we have now is a flat list of calls. Please note - not all of
> them work, so it's more of a prototype that a stable product. But we
> are dedicated to deliver it :)
>
>
> //---------------------------------------------------------- -----------
> /**
> * read & parse the POM file from an IProject
> */
> public Model parsePom( final IProject project )
> throws MavenApiException;
>
> //---------------------------------------------------------- -----------
> /**
> * read & parse the POM file from an IFile
> */
> public Model parsePom( final IFile file )
> throws MavenApiException;
>
> //---------------------------------------------------------- -----------
> /**
> * read & parse the POM file from a real File.
> * <b>Please use with caution: this is not thread-safe call!! </b>
> */
> public Model parsePom( final File file )
> throws MavenApiException;
>
> //---------------------------------------------------------- -----------
> /**
> * return local repository
> */
> public ArtifactRepository localRepository() throws MavenApiException;
>
> //---------------------------------------------------------- -----------
> /**
> * take existing Eclipse project and mavenize it with the supplied
> model
> */
> public abstract IProject mavenizeProject( final
> ProjectMavenizationRequest req )
> throws MavenEclipseApiException
> ;
>
> //---------------------------------------------------------- -----------
> public abstract Artifact resolveArtifact( final ArtifactMetadata md )
> throws MavenApiException
> ;
>
> //---------------------------------------------------------- ---------------------------
>
> public abstract MetadataTreeNode resolveArtifactMetadataAsTree(
> ArtifactMetadata md
> )
> throws MavenApiException
> ;
>
> //---------------------------------------------------------- ---------------------------
>
> public abstract MavenProject resolveArtifactAsProject( final
> Artifact artifact )
> throws MavenApiException
> ;
>
> //---------------------------------------------------------- ---------------------------
>
> public abstract MetadataGraph resolveArtifactAsScopeGraph( final
> ArtifactMetadata md )
> throws MavenApiException
> ;
>
> //---------------------------------------------------------- ---------------------------
>
> public abstract List<Artifact> resolveArtifactAsClasspath( final
> ArtifactMetadata md )
> throws MavenApiException
> ;
> public Artifact resolveArtifact( final Artifact artifact )
> throws MavenApiException;
>
> //---------------------------------------------------------- ---------------------------
>
> public abstract Collection<Artifact> findGroup( String groupRegEx )
> throws MavenApiException
> ;
>
> //---------------------------------------------------------- ---------------------------
>
> public abstract Collection<Artifact> findArtifact( String query )
> throws MavenApiException
> ;
>
>
>
>
Re: new project - APIs for m2eclipse [message #3088 is a reply to message #1092] Fri, 18 April 2008 13:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tida.apa.gmail.com

Thank you!


On 4/17/08 12:27 PM, in article fu7tq0$ad3$1@build.eclipse.org, "Oleg
Gusakov" <oleg.subscriptions@gmail.com> wrote:

> Today - no :(
>
> There a sample usage in the test plugin project:
>
> MavenEclipseApi mavenApi =
> (MavenEclipseApi)MavenApiPlugin.getDefault().getMavenEclipse Api();
> mavenApi.[API call here] ...
>
> API calls are listed in the initial posting.
>
> But it's a very good point - cannot turn prototype into a product
> without docs and issue tracking. We will do that, most probably -
> publish a Maven site for it.
>
> Thank you for the comment!
Re: new project - APIs for m2eclipse [message #3213 is a reply to message #948] Fri, 18 April 2008 22:42 Go to previous message
Eclipse UserFriend
Originally posted by: oleg.subscriptions.gmail.com

This message spawned a discussion with the m2eclipse contributors, which
leads me to believe that this API should really be (and partially
already is) part of m2eclipse itself, maybe like a separate bundle there.

As of now - API is highly prototypical and is subjected to change,
although not to the extent that m2eclipse may be.

So let's treat this project as a playground for the m2eclipse API ideas,
which, once shaped as a non-contradictory set, will be migrated into
m2eclipse.
Previous Topic:eclipse and wtp versions
Next Topic:provisioning Maven settings and other configuration
Goto Forum:
  


Current Time: Thu Mar 28 13:17:17 GMT 2024

Powered by FUDForum. Page generated in 0.06117 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top