[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [m2e-dev] How to convert an instance of Project to MavenProject?
|
Hard to tell why this does not work for you. Did you check if the
expected project structure was created on filesystem? Do you see any
exceptions in the log?
Also, MavenProject cannot be used to mutate pom.xml on filesystem and
there is no good API to do this. Depending on your requirements you will
either need to create your own archetype (or just generate project
structure in your plugin) or use something like decentxml to
post-process pom.xml file generated by existing archetype.
--
Regards,
Igor
On 2014-09-16, 10:25, Danylo Esterman wrote:
I am programming an Eclipse Plug-In. A /NewWizard/ should became a part
of it. Its purpose is to simplify the creation of a maven project with
predefined parameters. I managed to handle this job so far using the
parts of |m2e.core.ui| to not reinvent the wheel, this snippet shows how
the project is created:
|final Job job= new AbstactCreateMavenProjectJob("Creating project" + projectName, workingSets)
{
@Override
protected List<IProject> doCreateMavenProjects(IProgressMonitor monitor) throws CoreException
{
List<IProject> projects= MavenPlugin.getProjectConfigurationManager()
.createArchetypeProjects(location, archetype, groupId,
artifactId, version, javaPackage,
properties, importConfiguration, monitor);
return projects;
}
};|
However I've got some additional requirements. I need to modify two
parameters of the created project. It should look kinda like that:
|IMavenProjectFacade mPFacade= MavenPlugin.getMavenProjectRegistry().getProject(projects.get(0));
mPFacade.getMavenProject().setVersion(null);
mPFacade.getMavenProject().getParentArtifact().setVersion("2.3.0-SNAPSHOT");|
But |MavenPlugin.getMavenProjectRegistry().getProjects();| returns an
empty array, so |getProject()| returns |null|. How to do the conversion
and set the parameters properly?
_______________________________________________
m2e-dev mailing list
m2e-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/m2e-dev