forked from eclipse-m2e/m2e-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the new plexus-build-api artifact
Fix eclipse-m2e#944
- Loading branch information
Showing
6 changed files
with
181 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.eclipse.m2e</groupId> | ||
<artifactId>m2e-core</artifactId> | ||
<version>2.1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>org.eclipse.m2e.tests.plugin</groupId> | ||
<artifactId>org.eclipse.m2e.tests.plugin</artifactId> | ||
<version>1.0.0</version> | ||
|
||
<packaging>maven-plugin</packaging> | ||
<name>M2Eclipse Test Maven Plugin</name> | ||
<description>This is a mavenplugin that implements some mojos used in m2e tests to test certain mojo behaviour.</description> | ||
<properties> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-core</artifactId> | ||
<version>3.8.5</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-plugin-api</artifactId> | ||
<version>3.8.5</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.plugin-tools</groupId> | ||
<artifactId>maven-plugin-annotations</artifactId> | ||
<version>3.8.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.codehaus.plexus</groupId> | ||
<artifactId>plexus-build-api</artifactId> | ||
<version>1.0.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.sonatype.plexus</groupId> | ||
<artifactId>plexus-build-api</artifactId> | ||
<version>0.0.7</version> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>3.1.0</version> | ||
<executions> | ||
<execution> | ||
<id>force-install</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>install</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
43 changes: 43 additions & 0 deletions
43
...pse.m2e.tests.plugin/src/main/java/org/eclipse/m2e/tests/plugin/PlexusBuildApiV0Mojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Christoph Läubrich | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.m2e.tests.plugin; | ||
|
||
import org.apache.maven.plugin.AbstractMojo; | ||
import org.apache.maven.plugin.MojoExecutionException; | ||
import org.apache.maven.plugin.MojoFailureException; | ||
import org.apache.maven.plugins.annotations.Component; | ||
import org.apache.maven.plugins.annotations.Mojo; | ||
import org.apache.maven.plugins.annotations.Parameter; | ||
import org.apache.maven.project.MavenProject; | ||
import org.sonatype.plexus.build.incremental.BuildContext; | ||
|
||
/** | ||
* This mojo test that we can use the V1 API | ||
*/ | ||
@Mojo(name = "m2e-test-buildapi-v0") | ||
public class PlexusBuildApiV0Mojo extends AbstractMojo { | ||
|
||
@Component | ||
BuildContext buildContext; | ||
|
||
@Parameter(property = "project", readonly = true) | ||
MavenProject mavenProject; | ||
|
||
public void execute() throws MojoExecutionException, MojoFailureException { | ||
String msg = "The buildContext is: " + buildContext.getClass().getName(); | ||
getLog().info(msg); | ||
buildContext.addMessage(mavenProject.getBasedir(), 1, 0, msg, BuildContext.SEVERITY_WARNING, null); | ||
// TODO we should have mojo parameter to do some usefull things for test... | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
...pse.m2e.tests.plugin/src/main/java/org/eclipse/m2e/tests/plugin/PlexusBuildApiV1Mojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Christoph Läubrich | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.m2e.tests.plugin; | ||
|
||
import org.apache.maven.plugin.AbstractMojo; | ||
import org.apache.maven.plugin.MojoExecutionException; | ||
import org.apache.maven.plugin.MojoFailureException; | ||
import org.apache.maven.plugins.annotations.Component; | ||
import org.apache.maven.plugins.annotations.Mojo; | ||
import org.apache.maven.plugins.annotations.Parameter; | ||
import org.apache.maven.project.MavenProject; | ||
import org.codehaus.plexus.build.BuildContext; | ||
|
||
/** | ||
* This mojo test that we can use the V1 API | ||
*/ | ||
@Mojo(name = "m2e-test-buildapi-v1") | ||
public class PlexusBuildApiV1Mojo extends AbstractMojo { | ||
|
||
@Component | ||
BuildContext buildContext; | ||
|
||
@Parameter(property = "project", readonly = true) | ||
MavenProject mavenProject; | ||
|
||
public void execute() throws MojoExecutionException, MojoFailureException { | ||
String msg = "The buildContext is: " + buildContext.getClass().getName(); | ||
getLog().info(msg); | ||
buildContext.addMessage(mavenProject.getBasedir(), 1, 0, msg, BuildContext.SEVERITY_WARNING, null); | ||
// TODO we should have mojo parameter to do some usefull things for test... | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters