Skip to content
Draft
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
47 changes: 37 additions & 10 deletions maven-plugin-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,13 @@ under the License.
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<version>2.0.0</version>
<configuration>
<models>
<model>src/main/mdo/lifecycle.mdo</model>
</models>
<version>1.0.0</version>
</configuration>
<executions>
<execution>
<id>modello</id>
<phase>none</phase>
<phase>none</phase><!-- java beans and readers/writers are generated with modello-plugin-velocity -->
</execution>
<execution>
<id>modello-site-docs</id>
<id>modello-site-docs-plugin-1.1</id>
<phase>pre-site</phase>
<configuration>
<models>
Expand All @@ -83,14 +76,26 @@ under the License.
<version>1.1.0</version>
</configuration>
</execution>
<execution>
<id>modello-site-docs-lifecycle</id>
<phase>pre-site</phase>
<configuration>
<configuration>
<models>
<model>src/main/mdo/lifecycle.mdo</model>
</models>
<version>1.0.0</version>
</configuration>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven</groupId>
<artifactId>modello-plugin-velocity</artifactId>
<executions>
<execution>
<id>velocity</id>
<id>velocity-lifecycle</id>
<phase>generate-sources</phase>
<goals>
<goal>velocity</goal>
Expand All @@ -112,6 +117,28 @@ under the License.
</params>
</configuration>
</execution>
<execution>
<id>velocity-plugin</id>
<phase>generate-sources</phase>
<goals>
<goal>velocity</goal>
</goals>
<configuration>
<version>1.1.0</version>
<models>
<model>src/main/mdo/plugin.mdo</model>
</models>
<templates>
<template>src/main/mdo/model.vm</template>
<template>src/main/mdo/reader.vm</template>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

should we generate a writer here or rather separately in m-plugin-tools?

</templates>
<params>
<param>packageModelV3=org.apache.maven.plugin.immutabledescriptor</param>
<param>packageModelV4=org.apache.maven.plugin.immutabledescriptor</param>
<param>packageToolV4=org.apache.maven.plugin.immutabledescriptor.io.xpp3</param>
</params>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.apache.maven.plugin.lifecycle;
package org.apache.maven.plugin;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down Expand Up @@ -38,7 +38,7 @@
import java.util.function.Predicate;
import java.util.function.UnaryOperator;

class ImmutableCollections
public class ImmutableCollections
{

private static final List<?> EMPTY_LIST = new AbstractImmutableList<Object>()
Expand Down Expand Up @@ -88,7 +88,7 @@ public int size()
}
};

static <E> List<E> copy( Collection<E> collection )
public static <E> List<E> copy( Collection<E> collection )
{
if ( collection == null )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* TODO is there a need for the delegation of MavenMojoDescriptor to this?
* Why not just extend ComponentDescriptor here?
*/
@Deprecated
public class MojoDescriptor
extends ComponentDescriptor<Mojo>
implements Cloneable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
/**
* @author Jason van Zyl
*/
@Deprecated
public class PluginDescriptor
extends ComponentSetDescriptor
implements Cloneable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
/**
* @author Jason van Zyl
*/
@Deprecated
public class PluginDescriptorBuilder
{
public PluginDescriptor build( Reader reader )
Expand Down
1 change: 1 addition & 0 deletions maven-plugin-api/src/main/mdo/model.vm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#set ( $dummy = $imports.add( "org.apache.maven.api.annotations.Nonnull" ) )
#set ( $dummy = $imports.add( "org.apache.maven.api.annotations.NotThreadSafe" ) )
#set ( $dummy = $imports.add( "org.apache.maven.api.annotations.ThreadSafe" ) )
#set ( $dummy = $imports.add( "org.apache.maven.plugin.ImmutableCollections" ) )
#foreach ( $field in $allFields )
#if ( $field.type == "java.util.List" )
#set ( $dummy = $imports.add( "java.util.ArrayList" ) )
Expand Down
76 changes: 74 additions & 2 deletions maven-plugin-api/src/main/mdo/plugin.mdo
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ under the License.
<defaults>
<default>
<key>package</key>
<value>plugin descriptor XML documentation (no java generation)</value><!-- intentionally non-buildable value -->
<value>org.apache.maven.plugin.descriptor</value><!-- intentionally non-buildable value -->
</default>
</defaults>
<classes>
Expand Down Expand Up @@ -370,7 +370,7 @@ under the License.
<class xdoc.anchorName="parameter">
<name>Parameter</name>
<version>1.0.0+</version>
<description>A phase mapping definition.</description>
<description>A parameter definition.</description>
<!-- see o.a.m.plugin.descriptor.Parameter -->
<fields>
<field>
Expand Down Expand Up @@ -455,6 +455,37 @@ under the License.
]]></description>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>1.1.0+</version> <!--previously the model has been handcrafted -->
<comment>Add setters/getters for expression and default value coming from the mojo's configuration</comment>
<code><![CDATA[
/* getters exposing information originally comfing from the mojo's configuration */
private String expression;
private String defaultValue;

public String getExpression()
{
return expression;
}

public void setExpression( String expression )
{
this.expression = expression;
}

public void setDefaultValue( String defaultValue )
{
this.defaultValue = defaultValue;
}

public String getDefaultValue()
{
return defaultValue;
}]]>
</code>
</codeSegment>
</codeSegments>
</class>

<class>
Expand Down Expand Up @@ -512,6 +543,26 @@ under the License.
<description>The field name which has this requirement.</description>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>1.1.0+</version> <!--previously the model has been handcrafted -->
<comment>Conversion to Plexus Component Requirement</comment>
<code><![CDATA[
/**
* Converts the given requirement to a Plexus Component Requirement
*/
org.codehaus.plexus.component.repository.ComponentRequirement toComponentRequirement()
{
org.codehaus.plexus.component.repository.ComponentRequirement componentRequirement
= new org.codehaus.plexus.component.repository.ComponentRequirement();
componentRequirement.setRole( role );
componentRequirement.setRoleHint( roleHint );
componentRequirement.setFieldName( fieldName );
return componentRequirement;
}]]>
</code>
</codeSegment>
</codeSegments>
</class>

<class xdoc.anchorName="dependency">
Expand Down Expand Up @@ -547,6 +598,27 @@ under the License.
<description>The type of dependency.</description>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>1.1.0+</version> <!--previously the model has been handcrafted -->
<comment>Conversion to Plexus Component Dependency</comment>
<code><![CDATA[
/**
* Converts the given dependency to a Plexus Component Dependency
*/
org.codehaus.plexus.component.repository.ComponentDependency toComponentDependency()
{
org.codehaus.plexus.component.repository.ComponentDependency componentDependency
= new org.codehaus.plexus.component.repository.ComponentDependency();
componentDependency.setGroupId( groupId );
componentDependency.setArtifactId( artifactId );
componentDependency.setVersion( version );
componentDependency.setType( type );
return componentDependency;
}]]>
</code>
</codeSegment>
</codeSegments>
</class>
</classes>
</model>

This file was deleted.