Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 4.0.99 as as intermediate model to keep 4.1.0 for the Maven 4.x model #1297

Merged
merged 3 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/maven-api-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ under the License.
<goal>velocity</goal>
</goals>
<configuration>
<version>4.2.0</version>
<version>4.1.0</version>
<velocityBasedir>${project.basedir}/../../src/mdo</velocityBasedir>
<models>
<model>src/main/mdo/maven.mdo</model>
Expand Down
44 changes: 27 additions & 17 deletions api/maven-api-model/src/main/mdo/maven.mdo
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<ul>
<li><a href="https://maven.apache.org/xsd/maven-v3_0_0.xsd">https://maven.apache.org/xsd/maven-v3_0_0.xsd</a> for Maven 1.1.</li>
<li><a href="https://maven.apache.org/xsd/maven-4.0.0.xsd">https://maven.apache.org/xsd/maven-4.0.0.xsd</a> for Maven 2.0.</li>
<li><a href="https://maven.apache.org/xsd/maven-4.1.0.xsd">https://maven.apache.org/xsd/maven-4.1.0.xsd</a> for Maven 4.0.</li>
</ul>
]]>
</description>
Expand All @@ -80,7 +81,7 @@

<field xml.transient="true">
<name>pomFile</name>
<version>4.2.0+</version>
<version>4.1.0+</version>
<required>false</required>
<description>Originating POM file</description>
<type>DOM</type> <!-- This is transformed to a File/Path in the template -->
Expand Down Expand Up @@ -387,7 +388,7 @@
</fields>
<codeSegments>
<codeSegment>
<version>4.0.0/4.1.0</version>
<version>4.0.0/4.0.99</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnodet What is this supposed to mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is closed ranged version notation. That's defined by modello...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry. I get it now. I thought this element was for documentation purposes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly, modello "version range" predates (AFAIK, someone may correct me) Maven ranges, and has totally different syntax...

<code>
<![CDATA[
/**
Expand Down Expand Up @@ -460,7 +461,7 @@
</code>
</codeSegment>
<codeSegment>
<version>4.2.0+</version>
<version>4.1.0+</version>
<code>
<![CDATA[
/**
Expand Down Expand Up @@ -650,7 +651,7 @@
</fields>
<codeSegments>
<codeSegment>
<version>4.0.0/4.1.0</version>
<version>4.0.0/4.0.99</version>
<code>
<![CDATA[
Map<String, Plugin> pluginMap;
Expand Down Expand Up @@ -688,7 +689,7 @@
</code>
</codeSegment>
<codeSegment>
<version>4.2.0+</version>
<version>4.1.0+</version>
<code>
<![CDATA[
volatile Map<String, Plugin> pluginMap;
Expand Down Expand Up @@ -1295,7 +1296,7 @@
</code>
</codeSegment>
<codeSegment>
<version>4.0.0/4.1.0</version>
<version>4.0.0/4.0.99</version>
<code>
<![CDATA[
public void setOptional( boolean optional )
Expand Down Expand Up @@ -2093,7 +2094,7 @@
</code>
</codeSegment>
<codeSegment>
<version>4.0.0/4.1.0</version>
<version>4.0.0/4.0.99</version>
<code>
<![CDATA[
public void setFiltering( boolean filtering )
Expand Down Expand Up @@ -2279,7 +2280,7 @@
</code>
</codeSegment>
<codeSegment>
<version>4.0.0/4.1.0</version>
<version>4.0.0/4.0.99</version>
<code>
<![CDATA[
public void setEnabled( boolean enabled )
Expand Down Expand Up @@ -2499,7 +2500,7 @@
</code>
</codeSegment>
<codeSegment>
<version>4.0.0/4.1.0</version>
<version>4.0.0/4.0.99</version>
<code>
<![CDATA[
public void setExtensions(boolean extensions) {
Expand Down Expand Up @@ -2574,7 +2575,7 @@
</code>
</codeSegment>
<codeSegment>
<version>4.2.0+</version>
<version>4.1.0+</version>
<code>
<![CDATA[
/**
Expand Down Expand Up @@ -2634,7 +2635,7 @@
</field>
<field xml.transient="true">
<name>priority</name>
<version>4.0.0</version>
<version>4.0.0/4.0.99</version>
<type>int</type>
<description>
<![CDATA[
Expand All @@ -2649,9 +2650,13 @@
<name>priority</name>
<version>4.1.0+</version>
<type>int</type>
<description>The priority of this execution compared to other executions which are bound to the same phase.
<description>
<![CDATA[
The priority of this execution compared to other executions which are bound to the same phase.
Executions derived from the default lifecycle have a negative priority by default so that they are executed
before any custom plugin executions.
<br><b>Since</b>: Maven 4.0.0
]]>
</description>
</field>
<field>
Expand Down Expand Up @@ -2761,7 +2766,7 @@
</code>
</codeSegment>
<codeSegment>
<version>4.0.0/4.1.0</version>
<version>4.0.0/4.0.99</version>
<code>
<![CDATA[
public void setExcludeDefaults( boolean excludeDefaults )
Expand Down Expand Up @@ -2813,7 +2818,7 @@
</fields>
<codeSegments>
<codeSegment>
<version>4.0.0/4.1.0</version>
<version>4.0.0/4.0.99</version>
<code>
<![CDATA[
public static final String SOURCE_POM = "pom";
Expand Down Expand Up @@ -2841,7 +2846,7 @@
</code>
</codeSegment>
<codeSegment>
<version>4.2.0+</version>
<version>4.1.0+</version>
<code>
<![CDATA[
public static final String SOURCE_POM = "pom";
Expand Down Expand Up @@ -3293,13 +3298,18 @@
<field>
<name>configuration</name>
<version>4.1.0+</version>
<description>The configuration of the extension.</description>
<description>
<![CDATA[
The configuration of the extension.
<br><b>Since</b>: Maven 4.0.0
]]>
</description>
<type>DOM</type>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>4.2.0+</version>
<version>4.1.0+</version>
<code>
<![CDATA[
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void injectTransformedArtifacts(MavenProject project, RepositorySystemSes
deferDeleteFile(consumer);

project.addAttachedArtifact(createConsumerPomArtifact(project, consumer, session));
} else if (project.getModel().isRoot()) {
} else if (project.getModel().getDelegate().isRoot()) {
throw new IllegalStateException(
"The use of the root attribute on the model requires the buildconsumer feature to be active");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.Set;

import org.apache.maven.RepositoryUtils;
import org.apache.maven.api.xml.XmlNode;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
Expand All @@ -50,6 +51,7 @@
import org.apache.maven.plugin.version.PluginVersionResolutionException;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.util.filter.ExclusionsDependencyFilter;
import org.slf4j.Logger;
Expand Down Expand Up @@ -151,7 +153,10 @@ public synchronized ProjectRealmCache.CacheRecord createProjectRealm(
plugin.setGroupId(extension.getGroupId());
plugin.setArtifactId(extension.getArtifactId());
plugin.setVersion(extension.getVersion());
plugin.setConfiguration(extension.getConfiguration());
XmlNode configuration = extension.getDelegate().getConfiguration();
if (configuration != null) {
plugin.setConfiguration(new Xpp3Dom(configuration));
}
extensionPlugins.add(plugin);
}

Expand Down
1 change: 1 addition & 0 deletions maven-embedder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ under the License.
<id>modello</id>
<goals>
<goal>velocity</goal>
<goal>xsd</goal>
</goals>
</execution>
</executions>
Expand Down
6 changes: 3 additions & 3 deletions maven-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ under the License.
<configuration>
<basedir>${project.basedir}/../api/maven-api-model</basedir>
<velocityBasedir>${project.basedir}/../src/mdo</velocityBasedir>
<version>4.0.0</version>
<version>4.1.0</version>
<models>
<model>src/main/mdo/maven.mdo</model>
</models>
Expand Down Expand Up @@ -107,7 +107,7 @@ under the License.
</goals>
<phase>generate-sources</phase>
<configuration>
<version>4.1.0</version>
<version>4.0.99</version>
<templates>
<template>model-v3.vm</template>
</templates>
Expand All @@ -120,7 +120,7 @@ under the License.
</goals>
<phase>generate-sources</phase>
<configuration>
<version>4.2.0</version>
<version>4.1.0</version>
<templates>
<template>merger.vm</template>
<template>transformer.vm</template>
Expand Down
2 changes: 1 addition & 1 deletion src/mdo/model-v3.vm
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public class ${class.name}
update(getDelegate().with${cap}(null));
}
} else {
throw new IllegalArgumentException("Expected an Xpp3Dom object but received: " + ${field.name});
throw new IllegalArgumentException("Expected an Xpp3Dom object but received a " + ${field.name}.getClass() + ": " + ${field.name});
}
#elseif( $field.type == "java.util.Properties" )
Map<String, String> map = ${field.name}.entrySet().stream()
Expand Down