maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Milos Kleint (JIRA)" <j...@codehaus.org>
Subject [jira] Commented: (MNG-4131) MavenXpp3Writer.write( writer, model ) does not write the <groupId> for <plugin> sections under <pluginManagement> when the "groupId" is "org.apache.maven.plugins"
Date Tue, 14 Apr 2009 07:49:52 GMT

    [ http://jira.codehaus.org/browse/MNG-4131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=172873#action_172873
] 

Milos Kleint commented on MNG-4131:
-----------------------------------

afaik if anything has a default value defined in the model, then the xpp3 writer will remove
it. 
Additionally it doesn't respect previous formatting so it might not be the best pick for processing
and writing poms.


> 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

        

Mime
View raw message