new project - APIs for m2eclipse [message #948] |
Wed, 16 April 2008 23:29  |
Eclipse User |
|
|
|
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: public APIs for m2eclipse [message #1117 is a reply to message #948] |
Thu, 17 April 2008 12:44   |
Eclipse User |
|
|
|
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 #3213 is a reply to message #948] |
Fri, 18 April 2008 18:42  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.31422 seconds