Skip to content

Commit

Permalink
Upgrade to 4.0.0-beta-3
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed May 23, 2024
1 parent 641eaf8 commit 4699091
Show file tree
Hide file tree
Showing 33 changed files with 1,288 additions and 401 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/maven-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ jobs:
build:
name: Verify
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
with:
maven-matrix: '[ "3.6.3", "3.9.6", "4.0.0-alpha-13" ]'
39 changes: 31 additions & 8 deletions maven-plugin-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
</properties>

<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-api</artifactId>
Expand Down Expand Up @@ -100,20 +95,35 @@
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-repository-metadata</artifactId>
<version>${maven3Version}</version>
<artifactId>maven-compat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-api</artifactId>
<version>2.0.0-alpha-7</version>
</dependency>

<!-- plexus -->
<dependency>
Expand All @@ -137,6 +147,12 @@
<version>0.0.7</version>
</dependency>

<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>

<!-- tests -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -163,6 +179,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-di</artifactId>
<version>${maven4Version}</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down
1 change: 1 addition & 0 deletions maven-plugin-plugin/src/it/ant-basic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<artifactId>maven-plugin-plugin</artifactId>
<version>${pluginPluginVersion}</version>
<configuration>
<requiredMavenVersion>3.6.3</requiredMavenVersion>
<goalPrefix>antBasic</goalPrefix>
</configuration>
<dependencies>
Expand Down
1 change: 1 addition & 0 deletions maven-plugin-plugin/src/it/ant-reference-parameter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<artifactId>maven-plugin-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<requiredMavenVersion>3.6.3</requiredMavenVersion>
<goalPrefix>antWithRefs</goalPrefix>
</configuration>
<dependencies>
Expand Down
1 change: 1 addition & 0 deletions maven-plugin-plugin/src/it/ant-simple-usage/plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<artifactId>maven-plugin-plugin</artifactId>
<version>${pluginPluginVersion}</version>
<configuration>
<requiredMavenVersion>3.6.3</requiredMavenVersion>
<goalPrefix>antSimpleUsage</goalPrefix>
</configuration>
<dependencies>
Expand Down
1 change: 1 addition & 0 deletions maven-plugin-plugin/src/it/ant-since-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
</dependency>
</dependencies>
<configuration>
<requiredMavenVersion>3.6.3</requiredMavenVersion>
<goalPrefix>prefix</goalPrefix>
</configuration>
</plugin>
Expand Down
1 change: 1 addition & 0 deletions maven-plugin-plugin/src/it/beanshell-simple/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<artifactId>maven-plugin-plugin</artifactId>
<version>${pluginPluginVersion}</version>
<configuration>
<requiredMavenVersion>3.6.3</requiredMavenVersion>
<goalPrefix>beanshellBasic</goalPrefix>
</configuration>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@

import org.apache.maven.api.MojoExecution;
import org.apache.maven.api.Project;
import org.apache.maven.api.ResolutionScope;
import org.apache.maven.api.Session;
import org.apache.maven.api.di.Inject;
import org.apache.maven.api.di.Named;
import org.apache.maven.api.plugin.Log;
import org.apache.maven.api.plugin.MojoException;
import org.apache.maven.api.plugin.annotations.Component;
import org.apache.maven.api.plugin.annotations.Execute;
import org.apache.maven.api.plugin.annotations.LifecyclePhase;
import org.apache.maven.api.plugin.annotations.Mojo;
import org.apache.maven.api.plugin.annotations.Parameter;
import org.apache.maven.api.services.ArtifactInstaller;
Expand All @@ -38,15 +37,12 @@
* Test mojo for the v4 api plugin descriptor generation.
* This mojo is not actually runnable because:
* - it's using a custom lifecycle which is not defined
* - it has a @Component dependency on ArtifactInstaller (hint=test) which does not exist
* - it has a @Inject dependency on ArtifactInstaller (hint=test) which does not exist
*
* @since 1.2
*/
@Mojo(
name = "first",
requiresDependencyResolution = ResolutionScope.TEST,
defaultPhase = LifecyclePhase.INTEGRATION_TEST)
@Execute(phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura")
@Mojo(name = "first", defaultPhase = "integration-test")
@Execute(phase = "generate-sources", lifecycle = "cobertura")
public class FirstMojo implements org.apache.maven.api.plugin.Mojo {

/**
Expand All @@ -66,23 +62,24 @@ public class FirstMojo implements org.apache.maven.api.plugin.Mojo {
@Parameter(name = "namedParam", alias = "alias")
private String aliasedParam;

@Component
@Inject
private Session session;

@Component
@Inject
private Project project;

@Component
@Inject
private MojoExecution mojo;

@Component
@Inject
private Settings settings;

@Component
@Inject
private Log log;

@Component(role = ArtifactInstaller.class, hint = "test")
private Object custom;
@Inject
@Named("test")
private ArtifactInstaller custom;

public void execute() throws MojoException {}
}
53 changes: 10 additions & 43 deletions maven-plugin-plugin/src/it/v4api/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,60 +24,21 @@ assert descriptorFile.isFile()

def pluginDescriptor = new XmlParser().parse( descriptorFile );

assert pluginDescriptor.requiredJavaVersion.text() == '1.8'
assert pluginDescriptor.requiredMavenVersion.text() == '4.0.0-alpha-4'
assert pluginDescriptor.requiredJavaVersion.text() == '17'
assert pluginDescriptor.requiredMavenVersion.text() == '4.0.0-beta-3'

def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first" }[0]

assert mojo.goal.text() == 'first'
assert mojo.implementation.text() == 'org.apache.maven.its.v4api.FirstMojo'
assert mojo.language.text() == 'java'
assert mojo.description.text().startsWith('Test mojo for the v4 api plugin descriptor generation.')
assert mojo.requiresDependencyResolution.text() == 'test'
assert mojo.requiresDependencyCollection.text() == ''
assert mojo.requiresProject.text() == 'true'
assert mojo.requiresOnline.text() == 'false'
assert mojo.requiresDirectInvocation.text() == 'false'
assert mojo.projectRequired.text() == 'true'
assert mojo.onlineRequired.text() == 'false'
assert mojo.aggregator.text() == 'false'
assert mojo.threadSafe.text() == 'false'
assert mojo.phase.text() == 'integration-test'
assert mojo.executePhase.text() == 'generate-sources'
assert mojo.executeLifecycle.text() == 'cobertura'
assert mojo.v4Api.text() == 'true'

assert mojo.configuration.basedir[0].text() == ''
assert mojo.configuration.basedir[0].'@implementation' == 'java.nio.file.Path'
assert mojo.configuration.basedir[0].'@default-value' == '${basedir}'

assert mojo.configuration.touchFile[0].text() == '${first.touchFile}'
assert mojo.configuration.touchFile[0].'@implementation' == 'java.nio.file.Path'
assert mojo.configuration.touchFile[0].'@default-value' == '${project.build.directory}/touch.txt'

assert mojo.requirements.requirement.size() == 6

assert mojo.requirements.requirement[0].role.text() == 'org.apache.maven.api.services.ArtifactInstaller'
assert mojo.requirements.requirement[0].'role-hint'.text() == 'test'
assert mojo.requirements.requirement[0].'field-name'.text() == 'custom'

assert mojo.requirements.requirement[1].role.text() == 'org.apache.maven.api.plugin.Log'
assert mojo.requirements.requirement[1].'role-hint'.isEmpty()
assert mojo.requirements.requirement[1].'field-name'.text() == 'log'

assert mojo.requirements.requirement[2].role.text() == 'org.apache.maven.api.MojoExecution'
assert mojo.requirements.requirement[2].'role-hint'.isEmpty()
assert mojo.requirements.requirement[2].'field-name'.text() == 'mojo'

assert mojo.requirements.requirement[3].role.text() == 'org.apache.maven.api.Project'
assert mojo.requirements.requirement[3].'role-hint'.isEmpty()
assert mojo.requirements.requirement[3].'field-name'.text() == 'project'

assert mojo.requirements.requirement[4].role.text() == 'org.apache.maven.api.Session'
assert mojo.requirements.requirement[4].'role-hint'.isEmpty()
assert mojo.requirements.requirement[4].'field-name'.text() == 'session'

assert mojo.requirements.requirement[5].role.text() == 'org.apache.maven.api.settings.Settings'
assert mojo.requirements.requirement[5].'role-hint'.isEmpty()
assert mojo.requirements.requirement[5].'field-name'.text() == 'settings'

assert mojo.parameters.parameter.size() == 3

Expand All @@ -90,6 +51,8 @@ assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'false'
assert parameter.editable.text() == 'false'
assert parameter.description.text() == 'Project directory.'
assert parameter.defaultValue.text() == '${basedir}'
assert parameter.expression.isEmpty()

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "touchFile" }[0]
assert parameter.name.text() == 'touchFile'
Expand All @@ -100,6 +63,8 @@ assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'true'
assert parameter.editable.text() == 'true'
assert parameter.description.text() == ''
assert parameter.defaultValue.text() == '${project.build.directory}/touch.txt'
assert parameter.expression.text() == '${first.touchFile}'

parameter = mojo.parameters.parameter.findAll{ it.name.text() == "namedParam" }[0]
assert parameter.name.text() == 'namedParam'
Expand All @@ -110,6 +75,8 @@ assert parameter.deprecated.text() == 'As of 0.2'
assert parameter.required.text() == 'false'
assert parameter.editable.text() == 'true'
assert parameter.description.text() == ''
assert parameter.defaultValue.isEmpty()
assert parameter.expression.isEmpty()

// check help mojo source and class
assert new File( basedir, "target/classes/org/apache/maven/its/v4api/HelpMojo.class" ).isFile()
Expand Down
Loading

0 comments on commit 4699091

Please sign in to comment.