Merge pull request #549 from apache/drop-components-xml
[MNG-7263] Convert maven-core components XML to Providers
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java
index f85f4ea..db101bf 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java
@@ -30,6 +30,7 @@
*/
public interface ArtifactHandler
{
+ @Deprecated
String ROLE = ArtifactHandler.class.getName();
/**
diff --git a/maven-compat/pom.xml b/maven-compat/pom.xml
index d27b689..ed90947 100644
--- a/maven-compat/pom.xml
+++ b/maven-compat/pom.xml
@@ -79,6 +79,10 @@
<artifactId>maven-resolver-impl</artifactId>
</dependency>
<dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
diff --git a/maven-compat/src/main/mdo/profiles.mdo b/maven-compat/src/main/mdo/profiles.mdo
index bcaabd2..5132490 100644
--- a/maven-compat/src/main/mdo/profiles.mdo
+++ b/maven-compat/src/main/mdo/profiles.mdo
@@ -307,8 +307,10 @@
<field>
<name>checksumPolicy</name>
<version>1.0.0</version>
- <description>What to do when verification of an artifact checksum fails - warn, fail, etc. Valid values are
- "fail" or "warn"</description>
+ <description>
+ What to do when verification of an artifact checksum fails. Valid values are "fail" (default for Maven 4 and
+ above), "warn" (default for Maven 2 and 3) or "ignore".
+ </description>
<type>String</type>
</field>
</fields>
diff --git a/maven-core/pom.xml b/maven-core/pom.xml
index 77c5140..1ff00fa 100644
--- a/maven-core/pom.xml
+++ b/maven-core/pom.xml
@@ -131,11 +131,23 @@
<artifactId>plexus-classworlds</artifactId>
</dependency>
<dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-interpolation</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-annotations</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
diff --git a/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java b/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
index 1f4abfc..a49b670 100644
--- a/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
+++ b/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
@@ -279,14 +279,16 @@
public static ArtifactHandler newHandler( Artifact artifact )
{
String type = artifact.getProperty( ArtifactProperties.TYPE, artifact.getExtension() );
- DefaultArtifactHandler handler = new DefaultArtifactHandler( type );
- handler.setExtension( artifact.getExtension() );
- handler.setLanguage( artifact.getProperty( ArtifactProperties.LANGUAGE, null ) );
- String addedToClasspath = artifact.getProperty( ArtifactProperties.CONSTITUTES_BUILD_PATH, "" );
- handler.setAddedToClasspath( Boolean.parseBoolean( addedToClasspath ) );
- String includesDependencies = artifact.getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES, "" );
- handler.setIncludesDependencies( Boolean.parseBoolean( includesDependencies ) );
- return handler;
+ return new DefaultArtifactHandler(
+ type,
+ artifact.getExtension(),
+ null,
+ null,
+ null,
+ Boolean.parseBoolean( artifact.getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES, "" ) ),
+ artifact.getProperty( ArtifactProperties.LANGUAGE, null ),
+ Boolean.parseBoolean( artifact.getProperty( ArtifactProperties.CONSTITUTES_BUILD_PATH, "" ) )
+ );
}
public static ArtifactType newArtifactType( String id, ArtifactHandler handler )
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java
index e4ab338..bb90aff 100644
--- a/maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java
+++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java
@@ -19,21 +19,18 @@
* under the License.
*/
-import javax.inject.Named;
-import javax.inject.Singleton;
+import static java.util.Objects.requireNonNull;
/**
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @author Jason van Zyl
*/
-@Named
-@Singleton
public class DefaultArtifactHandler
implements ArtifactHandler
{
- private String extension;
+ private final String type;
- private String type;
+ private String extension;
private String classifier;
@@ -47,27 +44,49 @@
private boolean addedToClasspath;
+ /**
+ * Default ctor for Plexus compatibility, as many plugins have artifact handlers declared in legacy Plexus XML.
+ * Do not use directly!
+ *
+ * @deprecated This ctor is present only for Plexus XML defined component compatibility, do not use it.
+ */
+ @Deprecated
public DefaultArtifactHandler()
{
+ this.type = null;
}
- public DefaultArtifactHandler( String type )
+ public DefaultArtifactHandler( final String type )
{
- this.type = type;
+ this(
+ type,
+ null,
+ null,
+ null,
+ null,
+ false,
+ null,
+ false
+ );
}
- public String getExtension()
+ public DefaultArtifactHandler( final String type,
+ final String extension,
+ final String classifier,
+ final String directory,
+ final String packaging,
+ final boolean includesDependencies,
+ final String language,
+ final boolean addedToClasspath )
{
- if ( extension == null )
- {
- extension = type;
- }
- return extension;
- }
-
- public void setExtension( String extension )
- {
+ this.type = requireNonNull( type );
this.extension = extension;
+ this.classifier = classifier;
+ this.directory = directory;
+ this.packaging = packaging;
+ this.includesDependencies = includesDependencies;
+ this.language = language;
+ this.addedToClasspath = addedToClasspath;
}
public String getType()
@@ -75,62 +94,97 @@
return type;
}
+ @Override
+ public String getExtension()
+ {
+ if ( extension == null )
+ {
+ return type;
+ }
+ return extension;
+ }
+
+ public void setExtension( final String extension )
+ {
+ this.extension = extension;
+ }
+
+ @Override
public String getClassifier()
{
return classifier;
}
+ public void setClassifier( final String classifier )
+ {
+ this.classifier = classifier;
+ }
+
+ @Override
public String getDirectory()
{
if ( directory == null )
{
- directory = getPackaging() + "s";
+ return getPackaging() + "s";
}
return directory;
}
+ public void setDirectory( final String directory )
+ {
+ this.directory = directory;
+ }
+
+ @Override
public String getPackaging()
{
if ( packaging == null )
{
- packaging = type;
+ return type;
}
return packaging;
}
+ public void setPackaging( final String packaging )
+ {
+ this.packaging = packaging;
+ }
+
+ @Override
public boolean isIncludesDependencies()
{
return includesDependencies;
}
- public void setIncludesDependencies( boolean includesDependencies )
+ public void setIncludesDependencies( final boolean includesDependencies )
{
this.includesDependencies = includesDependencies;
}
+ @Override
public String getLanguage()
{
if ( language == null )
{
- language = "none";
+ return "none";
}
return language;
}
- public void setLanguage( String language )
+ public void setLanguage( final String language )
{
this.language = language;
}
+ @Override
public boolean isAddedToClasspath()
{
return addedToClasspath;
}
- public void setAddedToClasspath( boolean addedToClasspath )
+ public void setAddedToClasspath( final boolean addedToClasspath )
{
this.addedToClasspath = addedToClasspath;
}
-
}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/EarArtifactHandlerProvider.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/EarArtifactHandlerProvider.java
new file mode 100644
index 0000000..57a582d
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/EarArtifactHandlerProvider.java
@@ -0,0 +1,57 @@
+package org.apache.maven.artifact.handler.providers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+@Named( "ear" )
+@Singleton
+public class EarArtifactHandlerProvider
+ implements Provider<ArtifactHandler>
+{
+ private final ArtifactHandler artifactHandler;
+
+ @Inject
+ public EarArtifactHandlerProvider()
+ {
+ this.artifactHandler = new DefaultArtifactHandler(
+ "ear",
+ null,
+ null,
+ null,
+ null,
+ true,
+ "java",
+ false
+ );
+ }
+
+ @Override
+ public ArtifactHandler get()
+ {
+ return artifactHandler;
+ }
+}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/EjbArtifactHandlerProvider.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/EjbArtifactHandlerProvider.java
new file mode 100644
index 0000000..fb5bfaa
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/EjbArtifactHandlerProvider.java
@@ -0,0 +1,57 @@
+package org.apache.maven.artifact.handler.providers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+@Named( "ejb" )
+@Singleton
+public class EjbArtifactHandlerProvider
+ implements Provider<ArtifactHandler>
+{
+ private final ArtifactHandler artifactHandler;
+
+ @Inject
+ public EjbArtifactHandlerProvider()
+ {
+ this.artifactHandler = new DefaultArtifactHandler(
+ "ejb",
+ "jar",
+ null,
+ null,
+ null,
+ false,
+ "java",
+ true
+ );
+ }
+
+ @Override
+ public ArtifactHandler get()
+ {
+ return artifactHandler;
+ }
+}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/EjbClientArtifactHandlerProvider.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/EjbClientArtifactHandlerProvider.java
new file mode 100644
index 0000000..86a224d
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/EjbClientArtifactHandlerProvider.java
@@ -0,0 +1,57 @@
+package org.apache.maven.artifact.handler.providers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+@Named( "ejb-client" )
+@Singleton
+public class EjbClientArtifactHandlerProvider
+ implements Provider<ArtifactHandler>
+{
+ private final ArtifactHandler artifactHandler;
+
+ @Inject
+ public EjbClientArtifactHandlerProvider()
+ {
+ this.artifactHandler = new DefaultArtifactHandler(
+ "ejb-client",
+ "jar",
+ "client",
+ null,
+ "ejb",
+ false,
+ "java",
+ true
+ );
+ }
+
+ @Override
+ public ArtifactHandler get()
+ {
+ return artifactHandler;
+ }
+}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/JarArtifactHandlerProvider.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/JarArtifactHandlerProvider.java
new file mode 100644
index 0000000..ed69ccb
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/JarArtifactHandlerProvider.java
@@ -0,0 +1,57 @@
+package org.apache.maven.artifact.handler.providers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+@Named( "jar" )
+@Singleton
+public class JarArtifactHandlerProvider
+ implements Provider<ArtifactHandler>
+{
+ private final ArtifactHandler artifactHandler;
+
+ @Inject
+ public JarArtifactHandlerProvider()
+ {
+ this.artifactHandler = new DefaultArtifactHandler(
+ "jar",
+ null,
+ null,
+ null,
+ null,
+ false,
+ "java",
+ true
+ );
+ }
+
+ @Override
+ public ArtifactHandler get()
+ {
+ return artifactHandler;
+ }
+}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/JavaSourceArtifactHandlerProvider.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/JavaSourceArtifactHandlerProvider.java
new file mode 100644
index 0000000..8d0d034
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/JavaSourceArtifactHandlerProvider.java
@@ -0,0 +1,57 @@
+package org.apache.maven.artifact.handler.providers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+@Named( "java-source" )
+@Singleton
+public class JavaSourceArtifactHandlerProvider
+ implements Provider<ArtifactHandler>
+{
+ private final ArtifactHandler artifactHandler;
+
+ @Inject
+ public JavaSourceArtifactHandlerProvider()
+ {
+ this.artifactHandler = new DefaultArtifactHandler(
+ "java-source",
+ "jar",
+ "sources",
+ null,
+ null,
+ false,
+ "java",
+ false
+ );
+ }
+
+ @Override
+ public ArtifactHandler get()
+ {
+ return artifactHandler;
+ }
+}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/JavadocArtifactHandlerProvider.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/JavadocArtifactHandlerProvider.java
new file mode 100644
index 0000000..82f7fce
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/JavadocArtifactHandlerProvider.java
@@ -0,0 +1,57 @@
+package org.apache.maven.artifact.handler.providers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+@Named( "javadoc" )
+@Singleton
+public class JavadocArtifactHandlerProvider
+ implements Provider<ArtifactHandler>
+{
+ private final ArtifactHandler artifactHandler;
+
+ @Inject
+ public JavadocArtifactHandlerProvider()
+ {
+ this.artifactHandler = new DefaultArtifactHandler(
+ "javadoc",
+ "jar",
+ "javadoc",
+ null,
+ null,
+ false,
+ "java",
+ true
+ );
+ }
+
+ @Override
+ public ArtifactHandler get()
+ {
+ return artifactHandler;
+ }
+}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/MavenPluginArtifactHandlerProvider.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/MavenPluginArtifactHandlerProvider.java
new file mode 100644
index 0000000..4b1a89f
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/MavenPluginArtifactHandlerProvider.java
@@ -0,0 +1,57 @@
+package org.apache.maven.artifact.handler.providers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+@Named( "maven-plugin" )
+@Singleton
+public class MavenPluginArtifactHandlerProvider
+ implements Provider<ArtifactHandler>
+{
+ private final ArtifactHandler artifactHandler;
+
+ @Inject
+ public MavenPluginArtifactHandlerProvider()
+ {
+ this.artifactHandler = new DefaultArtifactHandler(
+ "maven-plugin",
+ "jar",
+ null,
+ null,
+ null,
+ false,
+ "java",
+ true
+ );
+ }
+
+ @Override
+ public ArtifactHandler get()
+ {
+ return artifactHandler;
+ }
+}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/PomArtifactHandlerProvider.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/PomArtifactHandlerProvider.java
new file mode 100644
index 0000000..92bd813
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/PomArtifactHandlerProvider.java
@@ -0,0 +1,57 @@
+package org.apache.maven.artifact.handler.providers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+@Named( "pom" )
+@Singleton
+public class PomArtifactHandlerProvider
+ implements Provider<ArtifactHandler>
+{
+ private final ArtifactHandler artifactHandler;
+
+ @Inject
+ public PomArtifactHandlerProvider()
+ {
+ this.artifactHandler = new DefaultArtifactHandler(
+ "pom",
+ null,
+ null,
+ null,
+ null,
+ false,
+ "none",
+ false
+ );
+ }
+
+ @Override
+ public ArtifactHandler get()
+ {
+ return artifactHandler;
+ }
+}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/RarArtifactHandlerProvider.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/RarArtifactHandlerProvider.java
new file mode 100644
index 0000000..a8b8cac
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/RarArtifactHandlerProvider.java
@@ -0,0 +1,57 @@
+package org.apache.maven.artifact.handler.providers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+@Named( "rar" )
+@Singleton
+public class RarArtifactHandlerProvider
+ implements Provider<ArtifactHandler>
+{
+ private final ArtifactHandler artifactHandler;
+
+ @Inject
+ public RarArtifactHandlerProvider()
+ {
+ this.artifactHandler = new DefaultArtifactHandler(
+ "rar",
+ null,
+ null,
+ null,
+ null,
+ true,
+ "java",
+ false
+ );
+ }
+
+ @Override
+ public ArtifactHandler get()
+ {
+ return artifactHandler;
+ }
+}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/TestJarArtifactHandlerProvider.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/TestJarArtifactHandlerProvider.java
new file mode 100644
index 0000000..1aa1b93
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/TestJarArtifactHandlerProvider.java
@@ -0,0 +1,57 @@
+package org.apache.maven.artifact.handler.providers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+@Named( "test-jar" )
+@Singleton
+public class TestJarArtifactHandlerProvider
+ implements Provider<ArtifactHandler>
+{
+ private final ArtifactHandler artifactHandler;
+
+ @Inject
+ public TestJarArtifactHandlerProvider()
+ {
+ this.artifactHandler = new DefaultArtifactHandler(
+ "test-jar",
+ "jar",
+ "tests",
+ null,
+ "jar",
+ false,
+ "java",
+ true
+ );
+ }
+
+ @Override
+ public ArtifactHandler get()
+ {
+ return artifactHandler;
+ }
+}
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/WarArtifactHandlerProvider.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/WarArtifactHandlerProvider.java
new file mode 100644
index 0000000..3b119d9
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/providers/WarArtifactHandlerProvider.java
@@ -0,0 +1,57 @@
+package org.apache.maven.artifact.handler.providers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+@Named( "war" )
+@Singleton
+public class WarArtifactHandlerProvider
+ implements Provider<ArtifactHandler>
+{
+ private final ArtifactHandler artifactHandler;
+
+ @Inject
+ public WarArtifactHandlerProvider()
+ {
+ this.artifactHandler = new DefaultArtifactHandler(
+ "war",
+ null,
+ null,
+ null,
+ null,
+ true,
+ "java",
+ false
+ );
+ }
+
+ @Override
+ public ArtifactHandler get()
+ {
+ return artifactHandler;
+ }
+}
diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java b/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java
index 3b4e2ef..c6bf9b8 100644
--- a/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java
+++ b/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java
@@ -56,6 +56,7 @@
return Collections.emptyList();
}
+ // TODO: this is duplicate of MavenPluginArtifactHandlerProvider provided one
static class PluginArtifactHandler
implements ArtifactHandler
{
diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java b/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java
index 46e56dc..af63596 100644
--- a/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java
+++ b/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java
@@ -65,6 +65,7 @@
}
+ // TODO: this is duplicate of PomArtifactHandlerProvider provided one
static class PomArtifactHandler
implements ArtifactHandler
{
diff --git a/maven-core/src/main/resources/META-INF/plexus/artifact-handlers.xml b/maven-core/src/main/resources/META-INF/plexus/artifact-handlers.xml
deleted file mode 100644
index 2f26ce2..0000000
--- a/maven-core/src/main/resources/META-INF/plexus/artifact-handlers.xml
+++ /dev/null
@@ -1,194 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<!--
-
-Artifact handlers are required by the dependency resolution mechanism.
-
--->
-
-<component-set>
- <components>
- <!--
- | POM
- |-->
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>pom</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <type>pom</type>
- </configuration>
- </component>
-
- <!--
- | JAR
- |-->
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>jar</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <type>jar</type>
- <language>java</language>
- <addedToClasspath>true</addedToClasspath>
- </configuration>
- </component>
-
- <!--
- | EJB
- |-->
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>ejb</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <type>ejb</type>
- <extension>jar</extension>
- <language>java</language>
- <addedToClasspath>true</addedToClasspath>
- </configuration>
- </component>
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>ejb-client</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <type>ejb-client</type>
- <extension>jar</extension>
- <packaging>ejb</packaging>
- <classifier>client</classifier>
- <language>java</language>
- <addedToClasspath>true</addedToClasspath>
- </configuration>
- </component>
-
- <!--
- | TEST JAR
- |-->
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>test-jar</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <classifier>tests</classifier>
- <extension>jar</extension>
- <type>test-jar</type>
- <packaging>jar</packaging>
- <language>java</language>
- <addedToClasspath>true</addedToClasspath>
- </configuration>
- </component>
-
- <!--
- | MAVEN PLUGIN
- |-->
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>maven-plugin</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <type>maven-plugin</type>
- <extension>jar</extension>
- <language>java</language>
- <addedToClasspath>true</addedToClasspath>
- </configuration>
- </component>
-
- <!--
- | SOURCE JAR
- |-->
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>java-source</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <classifier>sources</classifier>
- <type>java-source</type>
- <extension>jar</extension>
- <language>java</language>
- <addedToClasspath>false</addedToClasspath>
- </configuration>
- </component>
-
- <!--
- | JAVADOC JAR
- |-->
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>javadoc</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <classifier>javadoc</classifier>
- <type>javadoc</type>
- <extension>jar</extension>
- <language>java</language>
- <addedToClasspath>true</addedToClasspath>
- </configuration>
- </component>
-
- <!--
- | WAR
- |-->
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>war</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <type>war</type>
- <includesDependencies>true</includesDependencies>
- <language>java</language>
- <addedToClasspath>false</addedToClasspath>
- </configuration>
- </component>
-
- <!--
- | EAR
- |-->
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>ear</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <type>ear</type>
- <includesDependencies>true</includesDependencies>
- <language>java</language>
- <addedToClasspath>false</addedToClasspath>
- </configuration>
- </component>
-
- <!--
- | RAR
- |-->
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>rar</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <type>rar</type>
- <includesDependencies>true</includesDependencies>
- <language>java</language>
- <addedToClasspath>false</addedToClasspath>
- </configuration>
- </component>
-
- </components>
-</component-set>
diff --git a/maven-core/src/test/java/org/apache/maven/plugin/internal/MavenPluginValidatorTest.java b/maven-core/src/test/java/org/apache/maven/plugin/internal/MavenPluginValidatorTest.java
index cd96409..8728096 100644
--- a/maven-core/src/test/java/org/apache/maven/plugin/internal/MavenPluginValidatorTest.java
+++ b/maven-core/src/test/java/org/apache/maven/plugin/internal/MavenPluginValidatorTest.java
@@ -52,7 +52,7 @@
public void testValidate()
{
Artifact plugin = new DefaultArtifact( "org.apache.maven.its.plugins", "maven-it-plugin", "0.1", "compile",
- "jar", null, new DefaultArtifactHandler() );
+ "jar", null, new DefaultArtifactHandler( "ignore" ) );
PluginDescriptor descriptor = new PluginDescriptor();
descriptor.setGroupId( "org.apache.maven.its.plugins" );
descriptor.setArtifactId( "maven-it-plugin" );
@@ -66,7 +66,7 @@
public void testInvalidGroupId()
{
Artifact plugin = new DefaultArtifact( "org.apache.maven.its.plugins", "maven-it-plugin", "0.1", "compile",
- "jar", null, new DefaultArtifactHandler() );
+ "jar", null, new DefaultArtifactHandler( "ignore" ) );
PluginDescriptor descriptor = new PluginDescriptor();
descriptor.setGroupId( "org.apache.maven.its.plugins.invalid" );
descriptor.setArtifactId( "maven-it-plugin" );
@@ -80,7 +80,7 @@
public void testInvalidArtifactId()
{
Artifact plugin = new DefaultArtifact( "org.apache.maven.its.plugins", "maven-it-plugin", "0.1", "compile",
- "jar", null, new DefaultArtifactHandler() );
+ "jar", null, new DefaultArtifactHandler( "ignore" ) );
PluginDescriptor descriptor = new PluginDescriptor();
descriptor.setGroupId( "org.apache.maven.its.plugins" );
descriptor.setArtifactId( "maven-it-plugin.invalid" );
@@ -94,7 +94,7 @@
public void testInvalidVersion()
{
Artifact plugin = new DefaultArtifact( "org.apache.maven.its.plugins", "maven-it-plugin", "0.1", "compile",
- "jar", null, new DefaultArtifactHandler() );
+ "jar", null, new DefaultArtifactHandler( "ignore" ) );
PluginDescriptor descriptor = new PluginDescriptor();
descriptor.setGroupId( "org.apache.maven.its.plugins" );
descriptor.setArtifactId( "maven-it-plugin" );
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java
index d4a489c..1f61441 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java
@@ -22,7 +22,7 @@
import java.io.File;
import java.io.IOException;
-import org.apache.commons.lang3.SystemUtils;
+import org.codehaus.plexus.util.Os;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -57,7 +57,7 @@
public void testWindowsPaths()
throws Exception
{
- assumeTrue( SystemUtils.IS_OS_WINDOWS );
+ assumeTrue( Os.isFamily( "Windows" ) );
File upperCaseFile = createTempFile( "TESTE" );
String absolutePath = upperCaseFile.getAbsolutePath();
diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java
index 52aded3..e8df309 100644
--- a/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java
+++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java
@@ -41,6 +41,18 @@
super( message, cause );
}
+ /**
+ * Constructs a new {@code AbstractMojoExecutionException} exception wrapping an underlying {@code Throwable}.
+ *
+ * @param cause the cause which is saved for later retrieval by the {@link #getCause()} method.
+ * A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
+ * @since 3.8.3
+ */
+ public AbstractMojoExecutionException( Throwable cause )
+ {
+ super( cause );
+ }
+
public String getLongMessage()
{
return longMessage;
diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java
index 4d8c416..6d08989 100644
--- a/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java
+++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java
@@ -76,4 +76,17 @@
{
super( message );
}
+
+ /**
+ * Constructs a new {@code MojoExecutionException} exception wrapping an underlying {@code Throwable}.
+ *
+ * @param cause the cause which is saved for later retrieval by the {@link #getCause()} method.
+ * A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
+ * @since 3.8.3
+ */
+ public MojoExecutionException( Throwable cause )
+ {
+ super( cause );
+ }
+
}
diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java
index 342d081..72faec6 100644
--- a/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java
+++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java
@@ -65,4 +65,17 @@
{
super( message, cause );
}
+
+ /**
+ * Constructs a new {@code MojoFailureException} exception wrapping an underlying {@code Throwable}.
+ *
+ * @param cause the cause which is saved for later retrieval by the {@link #getCause()} method.
+ * A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
+ * @since 3.8.3
+ */
+ public MojoFailureException( Throwable cause )
+ {
+ super( cause );
+ }
+
}
diff --git a/maven-resolver-provider/pom.xml b/maven-resolver-provider/pom.xml
index ad66af3..0027e34 100644
--- a/maven-resolver-provider/pom.xml
+++ b/maven-resolver-provider/pom.xml
@@ -36,10 +36,18 @@
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
+ <artifactId>maven-builder-support</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
<artifactId>maven-model-builder</artifactId>
</dependency>
<dependency>
diff --git a/maven-settings/src/main/mdo/settings.mdo b/maven-settings/src/main/mdo/settings.mdo
index b0498df..4500560 100644
--- a/maven-settings/src/main/mdo/settings.mdo
+++ b/maven-settings/src/main/mdo/settings.mdo
@@ -968,8 +968,8 @@
<name>checksumPolicy</name>
<version>1.0.0+</version>
<description>
- What to do when verification of an artifact checksum fails -
- warn, fail, etc. Valid values are "fail" or "warn".
+ What to do when verification of an artifact checksum fails. Valid values are "fail" (default for Maven 4 and
+ above), "warn" (default for Maven 2 and 3) or "ignore".
</description>
<type>String</type>
</field>