Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [iam-dev] New Pom modification utility

I haven't looked at the details, but having the information as a wiki page would be extremely valuable.

Also, tracking all the code that needs to use the utility class instead of directly modifying the pom as a bugzilla ticket would be useful.

Is there any possible issues with dependency cycles?


El 04/01/2009, a las 18:49, Michael Poindexter escribió:

I've added a simple utility class to perform formatting preserving modifications to POM files. This code lives in org.eclipse.iam.pom.util.PomModifier. An example of usage is below:

final Collection<Dependency> dependencies = getDependencies();
                        IFile pomFile = getPomFile();
PomModifier.modifyPom( pomFile, new PomModificationAction() { public boolean modify( Model model, IProgressMonitor progressMonitor )
                             {
                                 model.getDependencies().clear();
                                 for( Dependency d : dependencies )
                                 {
org.eclipse.iam.pom.Dependency dep = PomFactory.eINSTANCE.createDependency(); dep.setArtifactId( d.getArtifactId() ); dep.setClassifier( d.getClassifier() );
                                     dep.setGroupId( d.getGroupId() );
dep.setOptional( d.isOptional() );
                                     dep.setScope( d.getScope() );
dep.setSystemPath( d.getSystemPath() );
                                     dep.setType( d.getType() );
                                     dep.setVersion( d.getVersion() );
model.getDependencies().add( dep );
                                 }
                                 return true;
                             }
                        }, new NullProgressMonitor() );

This example would rewrite the <dependencies> section of the pom with a new set of dependencies while leaving the rest of the XML untouched. Any thoughts on this?

Mike
_______________________________________________
iam-dev mailing list
iam-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/iam-dev



Back to the top