pavan
pavan

Reputation: 791

eclipse api's to get current project's repository url

i am working on developing a eclipse plugin which takes code from repository and builds the code in hudson. for that i need to get the repository url of pom.xml are there any eclipse api's to get repository url of current project.

for example i have got the workspace of current project using this api.

import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;


IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceRoot root = workspace.getRoot();
    IPath location = root.getLocation();

Upvotes: 0

Views: 412

Answers (2)

mliebelt
mliebelt

Reputation: 15525

I think you should try to "stand on the shoulders of giants". Eclipse has now integrated m2e from Sonatype (formally m2eclipse), and I found the following in an XML file

M2E provides both a framework for building Maven-centric Eclipse tools and set of tools and user interface elements directly consumable by Eclipse Users. As a framework, M2E provides facilities to import and configure Maven projects in Eclipse workspace as well as APIs that allow m2e extensions to access Maven project metadata and participate in Maven project configuration and workspace build.

So you should look into m2e and check if the API allows what you want to do. I would start with plugin org.eclipse.m2e.core and study how to get access to the maven project ...

Upvotes: 1

clevertension
clevertension

Reputation: 7077

I think eclipse may not know the repository url in pom.xml,the eclipse maven plugin can tell you about them,but why not manually analyze the pom.xml as resource file?

Upvotes: 0

Related Questions