[
http://jira.codehaus.org/browse/MNG-4131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=172944#action_172944
]
Benjamin Bentmann commented on MNG-4131:
----------------------------------------
While there's a feature request for Modello (MODELLO-118) to explicitly write
defaults, too, the current behavior is by design. As Milos already pointed out,
Modello is concerned about the data model only and not about XML comments or
formatting. So if you intend to rewrite the POM for later consumption by a
human, you could have a look at the maven-release-manager or the
versions-maven-plugin which excercise the efforts to perform surgically changes
to the POM' XML.
> MavenXpp3Writer.write( writer, model ) does not write the <groupId> for
> <plugin> sections under <pluginManagement> when the "groupId" is
> "org.apache.maven.plugins"
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: MNG-4131
> URL: http://jira.codehaus.org/browse/MNG-4131
> Project: Maven 2
> Issue Type: Bug
> Components: Embedding
> Affects Versions: 2.0.9, 3.0-alpha-1
> Reporter: nambi sankaran
>
> I need to update the some sections of a super pom file for every release.
> Instead of writing a script, I am using maven-model library to read the Model
> of the pom.xml and update my stuff.
> then I am simply writing the file back into disk
> Following is the code.
> BufferedReader in = new BufferedReader( new
> FileReader(pomFilePath) );
>
> MavenXpp3Reader reader = new MavenXpp3Reader();
>
> Model model = reader.read(in);
>
> in.close();
>
> DistributionManagement dMgmt =
> model.getDistributionManagement();
> DeploymentRepository repository = dMgmt.getRepository();
>
> repository.setUrl(repositoryUrl);
>
> // write the pom file
> BufferedWriter out = new BufferedWriter(new FileWriter(
> pomFilePath ));
> MavenXpp3Writer writer = new MavenXpp3Writer();
>
> writer.write(out, model);
> MavenXpp3Writer.write( writer, model ) does not write the <groupId> for
> <plugin> sections under <pluginManagement> when the "groupId" is
> "org.apache.maven.plugins"
> Following is the code that does the work
> private void writePlugin(Plugin plugin, String tagName, XmlSerializer
> serializer)
> throws java.io.IOException
> {
> if ( plugin != null )
> {
> serializer.startTag( NAMESPACE, tagName );
> if ( plugin.getGroupId() != null && !plugin.getGroupId().equals(
> "org.apache.maven.plugins" ) )
> {
> serializer.startTag( NAMESPACE, "groupId" ).text(
> plugin.getGroupId() ).endTag( NAMESPACE, "groupId" );
> }
> As you see, the writePlugin method does not write the "groupId" , when the
> groupId is null or "org.apache.maven.plugins"
> Is this intended or a bug?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira