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
55 changes: 25 additions & 30 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ under the License.
</parent>

<artifactId>maven-toolchains-plugin</artifactId>
<version>3.2.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>

<name>Apache Maven Toolchains Plugin</name>
Expand All @@ -42,7 +42,7 @@ under the License.
</contributors>

<prerequisites>
<maven>3.6.3</maven>
<maven>${mavenVersion}</maven>
</prerequisites>

<scm>
Expand All @@ -67,8 +67,8 @@ under the License.
</distributionManagement>

<properties>
<javaVersion>8</javaVersion>
<mavenVersion>3.9.9</mavenVersion>
<javaVersion>17</javaVersion>
<mavenVersion>4.0.0-rc-3-SNAPSHOT</mavenVersion>
<project.build.outputTimestamp>2024-04-18T00:34:08Z</project.build.outputTimestamp>
</properties>

Expand All @@ -87,50 +87,51 @@ under the License.
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<artifactId>maven-api-core</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<artifactId>maven-api-di</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-xml</artifactId>
<groupId>org.apache.maven</groupId>
<artifactId>maven-xml</artifactId>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
<scope>provided</scope>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${mavenVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.15.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>4.0.0-beta-1</version>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
Expand All @@ -150,11 +151,5 @@ under the License.
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
35 changes: 15 additions & 20 deletions src/it/setup-custom-toolchain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ under the License.
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.3</version>
<version>3.15.1</version>
<scope>provided</scope>
</dependency>

Expand All @@ -71,28 +71,27 @@ under the License.
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.13.0</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<version>3.1.3</version>
</plugin>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>1.5.5</version>
<executions>
<execution>
<goals>
<goal>generate-metadata</goal>
</goals>
</execution>
</executions>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
<version>0.9.0.M3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.3</version>
<version>3.15.1</version>
<configuration>
<goalPrefix>toolchain</goalPrefix>
</configuration>
<executions>
<execution>
<id>default-descriptor</id>
Expand All @@ -103,10 +102,6 @@ under the License.
<goals>
<goal>helpmojo</goal>
</goals>
<configuration>
<!-- TODO: remove when upgrading plugin-tools to 3.4: see MPLUGIN-238 -->
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
</execution>
</executions>
</plugin>
Expand All @@ -128,9 +123,9 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.15.1</version>
<configuration>
<!-- see https://issues.apache.org/jira/browse/MNG-5346 -->
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
<goalPrefix>ctc</goalPrefix>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,65 +19,37 @@
package org.apache.maven.plugins.toolchain;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
import org.codehaus.plexus.component.configurator.ConfigurationListener;
import org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter;
import org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
import org.codehaus.plexus.configuration.PlexusConfiguration;
import org.apache.maven.api.xml.XmlNode;

/**
* Custom Plexus ConfigurationConverter to instantiate <code>ToolchainRequirement</code> from configuration.
*
* @author mkleint
* @see ToolchainsRequirement
*/
public class ToolchainConverter extends AbstractConfigurationConverter {
public class ToolchainConverter {

/**
* @see org.codehaus.plexus.component.configurator.converters.ConfigurationConverter#canConvert(java.lang.Class)
*/
@Override
public boolean canConvert(Class type) {
return ToolchainsRequirement.class.isAssignableFrom(type);
}

/**
* @see org.codehaus.plexus.component.configurator.converters.ConfigurationConverter#fromConfiguration(org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup, org.codehaus.plexus.configuration.PlexusConfiguration, java.lang.Class, java.lang.Class, java.lang.ClassLoader, org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator, org.codehaus.plexus.component.configurator.ConfigurationListener)
*/
@Override
public Object fromConfiguration(
ConverterLookup converterLookup,
PlexusConfiguration configuration,
Class type,
Class baseType,
ClassLoader classLoader,
ExpressionEvaluator expressionEvaluator,
ConfigurationListener listener)
throws ComponentConfigurationException {
public ToolchainsRequirement fromConfiguration(XmlNode configuration) {
ToolchainsRequirement retValue = new ToolchainsRequirement();

processConfiguration(retValue, configuration, expressionEvaluator);
processConfiguration(retValue, configuration);

return retValue;
}

private void processConfiguration(
ToolchainsRequirement requirement,
PlexusConfiguration configuration,
ExpressionEvaluator expressionEvaluator)
throws ComponentConfigurationException {
private void processConfiguration(ToolchainsRequirement requirement, XmlNode configuration) {
Map<String, Map<String, String>> map = new HashMap<>();

PlexusConfiguration[] tools = configuration.getChildren();
for (PlexusConfiguration tool : tools) {
List<XmlNode> tools = configuration.getChildren();
for (XmlNode tool : tools) {
String type = tool.getName();
PlexusConfiguration[] params = tool.getChildren();
List<XmlNode> params = tool.getChildren();

Map<String, String> parameters = new HashMap<>();
for (PlexusConfiguration param : params) {
for (XmlNode param : params) {
parameters.put(param.getName(), param.getValue());
}
map.put(type, parameters);
Expand Down
Loading
Loading