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: 3.0-alpha-1, 2.0.9
            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

        

Reply via email to