Skip to content

Commit

Permalink
Port effective-pom, effective-settings, evaluate and system mojos
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Jul 15, 2024
1 parent f9d4951 commit 5a49d4a
Show file tree
Hide file tree
Showing 78 changed files with 910 additions and 1,025 deletions.
184 changes: 70 additions & 114 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
<parent>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugins</artifactId>
<version>42</version>
<version>43</version>
<relativePath />
</parent>

<artifactId>maven-help-plugin</artifactId>
<version>3.4.2-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>

<name>Apache Maven Help Plugin</name>
Expand Down Expand Up @@ -64,132 +64,78 @@
</distributionManagement>

<properties>
<javaVersion>8</javaVersion>
<mavenVersion>3.6.3</mavenVersion>
<resolverVersion>1.4.1</resolverVersion>
<javaVersion>17</javaVersion>
<mavenVersion>4.0.0-beta-3</mavenVersion>

<guiceVersion>6.0.0</guiceVersion>
<sisuVersion>0.9.0.M2</sisuVersion>
<version.plexus-xml>4.0.3</version.plexus-xml>
<version.maven-plugin-tools>4.0.0-beta-1</version.maven-plugin-tools>
<project.build.outputTimestamp>2024-06-02T15:17:10Z</project.build.outputTimestamp>
</properties>

<dependencies>
<!-- maven core -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<artifactId>maven-api-core</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<artifactId>maven-api-model</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model-builder</artifactId>
<artifactId>maven-api-settings</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<artifactId>maven-api-impl</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<artifactId>maven-core</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-api</artifactId>
<version>${resolverVersion}</version>
<scope>provided</scope>
</dependency>

<!-- maven plugin tools -->
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-generators</artifactId>
<version>${version.maven-plugin-tools}</version>
<exclusions>
<!-- we only need one class HtmlToPlainTextConverter -->
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.velocity</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>net.sf.jtidy</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.ow2.asm</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>

<!-- shared -->
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
<version>3.4.2</version>
<exclusions>
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.maven.shared</groupId>-->
<!-- <artifactId>maven-shared-utils</artifactId>-->
<!-- <version>3.4.2</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>commons-io</groupId>-->
<!-- <artifactId>commons-io</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->

<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>3.1.1</version>
<exclusions>
<!-- we only need one interface MavenReport -->
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.maven.reporting</groupId>-->
<!-- <artifactId>maven-reporting-api</artifactId>-->
<!-- <version>3.1.1</version>-->
<!-- <exclusions>-->
<!-- &lt;!&ndash; we only need one interface MavenReport &ndash;&gt;-->
<!-- <exclusion>-->
<!-- <groupId>*</groupId>-->
<!-- <artifactId>*</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->

<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-interactivity-api</artifactId>
<version>1.3</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.codehaus.plexus</groupId>-->
<!-- <artifactId>plexus-interactivity-api</artifactId>-->
<!-- <version>1.3</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
Expand All @@ -199,6 +145,17 @@
<artifactId>plexus-xml</artifactId>
</dependency>

<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<version>7.0.0</version>
</dependency>

<!-- misc -->
<dependency>
<groupId>org.jdom</groupId>
Expand All @@ -218,34 +175,33 @@

<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<!-- 5.x requires at least Java 11 -->
<version>4.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>3.3.0</version>
<version>4.0.0-beta-1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>${mavenVersion}</version>
<scope>test</scope>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
<version>${sisuVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<!-- 5.x requires at least Java 11 -->
<version>4.11.0</version>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guiceVersion}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<version>3.5.0</version>
<executions>
<execution>
<id>enforce-currentproject</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
# specific language governing permissions and limitations
# under the License.

expression = project.name
expression = project.model.name
output = result.txt
artifact = org.apache.maven.plugins:maven-help-plugin
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
# specific language governing permissions and limitations
# under the License.

expression = project.name
expression = project.model.name
output = result.txt
2 changes: 1 addition & 1 deletion src/it/projects/evaluate/test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.

expression = project.description
expression = project.model.description
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,13 @@

import javax.xml.XMLConstants;

import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;

import org.codehaus.plexus.util.WriterFactory;
import org.apache.maven.api.Session;
import org.apache.maven.api.di.Inject;
import org.apache.maven.api.plugin.annotations.Parameter;
import org.codehaus.plexus.util.xml.XMLWriter;
import org.codehaus.plexus.util.xml.XmlWriterUtil;
import org.jdom2.Document;
Expand All @@ -48,24 +42,18 @@
* @since 2.1
*/
public abstract class AbstractEffectiveMojo extends AbstractHelpMojo {

/**
* Utility method to write an XML content in a given file.
* This options gives the option to output information in cases where the output has been suppressed by using
* <code>-q</code> (quiet option) in Maven.
*
* @param output is the wanted output file.
* @param content contains the XML content to be written to the file.
* @throws IOException if any
* @see AbstractHelpMojo#writeFile(File, String) if encoding is null.
* @since 4.0.0
*/
protected static void writeXmlFile(File output, String content) throws IOException {
if (output == null) {
return;
}
@Parameter(property = "forceStdout", defaultValue = "false")
protected boolean forceStdout;

output.getParentFile().mkdirs();
try (Writer out = WriterFactory.newXmlWriter(output)) {
out.write(content);
}
}
@Inject
protected Session session;

/**
* Write comments in the Effective POM/settings header.
Expand Down Expand Up @@ -124,23 +112,4 @@ protected static String prettyFormat(String effectiveModel, String encoding, boo
return effectiveModel;
}
}

/**
* Properties which provides a sorted keySet().
*/
protected static class SortedProperties extends Properties {
/** serialVersionUID */
static final long serialVersionUID = -8985316072702233744L;

/** {@inheritDoc} */
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public Set<Object> keySet() {
Set<Object> keynames = super.keySet();
List list = new ArrayList(keynames);
Collections.sort(list);

return new LinkedHashSet<>(list);
}
}
}
Loading

0 comments on commit 5a49d4a

Please sign in to comment.