[
https://issues.apache.org/jira/browse/MNG-7013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17227611#comment-17227611
]
Piotr Zygielo commented on MNG-7013:
------------------------------------
I think it works as designed, i.e. default is not written down.
#
[https://github.com/codehaus-plexus/modello/blob/5213c0b907068d088a8d626d373d711613f17643/modello-plugins/modello-plugin-java/src/main/java/org/codehaus/modello/plugin/java/AbstractJavaModelloGenerator.java#L324]
#
[https://github.com/apache/maven/blob/cecedd343002696d0abb50b32b541b8a6ba2883f/maven-model/src/main/mdo/maven.mdo#L2187]
# above produced {{MavenXpp3Writer.writePlugin}} with
{code:java}
if ( ( plugin.getGroupId() != null ) && !plugin.getGroupId().equals(
"org.apache.maven.plugin" ) )
{
serializer.startTag( NAMESPACE, "groupId" ).text(
plugin.getGroupId() ).endTag( NAMESPACE, "groupId" );
} {code}
# and with your {{mavenCompiler.setGroupId("org.apache.maven.plugins");}} you
get the result as described ().
> MavenXpp3Writer doesn't write plugin with groupId "org.apache.maven.plugins"
> ----------------------------------------------------------------------------
>
> Key: MNG-7013
> URL: https://issues.apache.org/jira/browse/MNG-7013
> Project: Maven
> Issue Type: Bug
> Components: Plugins and Lifecycle
> Affects Versions: 3.6.3
> Reporter: Carlos Matos
> Priority: Critical
>
> When writing a pom.xml, when I try to create a plugin with the groupId
> "org.apache.maven.plugins", this is ignored and the plugin is written without
> groupId in the pom.xml file. If I add a space at the end like:
> "org.apache.maven.plugins " it seems to work though.
>
> Here's some code to reproduce:
> {code:java}
> Model model = new Model();
> Writer writer = new FileWriter("pom.xml");
> Build build = new Build();
> List<Plugin> plugins = new ArrayList<>();
> Plugin mavenCompiler = new Plugin();
> mavenCompiler.setArtifactId("maven-compiler-plugin");
> mavenCompiler.setGroupId("org.apache.maven.plugins");
> mavenCompiler.setVersion("3.1");
> plugins.add(mavenCompiler);
> build.setPlugins(plugins);
> model.setName("test");
> model.setArtifactId("test");
> model.setModelVersion("4.0.0");
> model.setVersion("0.0.1");
> model.setGroupId("test");
> model.setBuild(build);
> new MavenXpp3Writer().write(writer, model);
> writer.close();
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)