mirror of https://github.com/apache/maven.git
[MNG-7924] Better control over and better integration with Resolver (#1299)
Integrate better and obtain better control over Resolver. These changes did stem from "JPMS module experiment" and are considered improvement but does not implement any functionality related to JPMS module support. Changes: * Maven4 should stop "disconnected coexistence" of two type systems (ArtifactHandlers and Resolver ArtifactTypeRegistry), it should unify them. * Maven4 Core should provide generic and extensible means to introduce new artifact types (fully in extension, and extension should get extended data via "roundtrip" in core/resolver) --- https://issues.apache.org/jira/browse/MNG-7924
This commit is contained in:
parent
e89b6fd53f
commit
eee037e676
|
@ -30,6 +30,14 @@ public interface Dependency extends Artifact {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
Type getType();
|
Type getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The dependency properties.
|
||||||
|
*
|
||||||
|
* @return the dependency properties, never {@code null}
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
DependencyProperties getDependencyProperties();
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
Scope getScope();
|
Scope getScope();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package org.apache.maven.api;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.maven.api.annotations.Experimental;
|
||||||
|
import org.apache.maven.api.annotations.Immutable;
|
||||||
|
import org.apache.maven.api.annotations.Nonnull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dependency properties supported by Maven Core.
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
@Experimental
|
||||||
|
@Immutable
|
||||||
|
public interface DependencyProperties {
|
||||||
|
/**
|
||||||
|
* Boolean flag telling that dependency contains all of its dependencies. Value of this key should be parsed with
|
||||||
|
* {@link Boolean#parseBoolean(String)} to obtain value.
|
||||||
|
* <p>
|
||||||
|
* <em>Important: this flag must be kept in sync with resolver! (as is used during collection)</em>
|
||||||
|
*/
|
||||||
|
String FLAG_INCLUDES_DEPENDENCIES = "includesDependencies";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean flag telling that dependency is meant to be placed on class path. Value of this key should be parsed with
|
||||||
|
* {@link Boolean#parseBoolean(String)} to obtain value.
|
||||||
|
*/
|
||||||
|
String FLAG_CLASS_PATH_CONSTITUENT = "classPathConstituent";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns immutable "map view" of all the properties.
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
Map<String, String> asMap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns {@code true} if given flag is {@code true}.
|
||||||
|
*/
|
||||||
|
boolean checkFlag(@Nonnull String flag);
|
||||||
|
}
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
import org.apache.maven.api.annotations.Experimental;
|
import org.apache.maven.api.annotations.Experimental;
|
||||||
import org.apache.maven.api.annotations.Immutable;
|
import org.apache.maven.api.annotations.Immutable;
|
||||||
|
import org.apache.maven.api.annotations.Nonnull;
|
||||||
|
import org.apache.maven.api.annotations.Nullable;
|
||||||
import org.apache.maven.api.model.Dependency;
|
import org.apache.maven.api.model.Dependency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,15 +53,17 @@ public interface Type {
|
||||||
* Returns the dependency type id.
|
* Returns the dependency type id.
|
||||||
* The id uniquely identifies this <i>dependency type</i>.
|
* The id uniquely identifies this <i>dependency type</i>.
|
||||||
*
|
*
|
||||||
* @return the id of this type
|
* @return the id of this type, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the file extension of artifacts of this type.
|
* Get the file extension of artifacts of this type.
|
||||||
*
|
*
|
||||||
* @return the file extension
|
* @return the file extension, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
String getExtension();
|
String getExtension();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,17 +71,20 @@ public interface Type {
|
||||||
* The default classifier can be overridden when specifying
|
* The default classifier can be overridden when specifying
|
||||||
* the {@link Dependency#getClassifier()}.
|
* the {@link Dependency#getClassifier()}.
|
||||||
*
|
*
|
||||||
* @return the default classifier
|
* @return the default classifier, or {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
String getClassifier();
|
String getClassifier();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies if the artifact contains java classes and should be
|
* Specifies if the artifact contains java classes and should be
|
||||||
* added to the classpath.
|
* added to the classpath.
|
||||||
*
|
*
|
||||||
* @return if the artifact should be added to the classpath
|
* @return if the artifact should be added to the class path
|
||||||
*/
|
*/
|
||||||
boolean isAddedToClasspath();
|
default boolean isAddedToClassPath() {
|
||||||
|
return getDependencyProperties().checkFlag(DependencyProperties.FLAG_CLASS_PATH_CONSTITUENT);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies if the artifact already embeds its own dependencies.
|
* Specifies if the artifact already embeds its own dependencies.
|
||||||
|
@ -86,5 +93,15 @@ public interface Type {
|
||||||
*
|
*
|
||||||
* @return if the artifact's dependencies are included in the artifact
|
* @return if the artifact's dependencies are included in the artifact
|
||||||
*/
|
*/
|
||||||
boolean isIncludesDependencies();
|
default boolean isIncludesDependencies() {
|
||||||
|
return getDependencyProperties().checkFlag(DependencyProperties.FLAG_INCLUDES_DEPENDENCIES);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the default properties associated with this dependency type.
|
||||||
|
*
|
||||||
|
* @return the default properties, never {@code null}.
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
DependencyProperties getDependencyProperties();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,47 +26,61 @@
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import org.apache.maven.api.Type;
|
||||||
|
import org.apache.maven.api.services.TypeRegistry;
|
||||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
||||||
|
import org.apache.maven.eventspy.AbstractEventSpy;
|
||||||
|
import org.apache.maven.execution.ExecutionEvent;
|
||||||
|
|
||||||
|
import static java.util.Objects.requireNonNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@Named
|
@Named
|
||||||
@Singleton
|
@Singleton
|
||||||
public class DefaultArtifactHandlerManager implements ArtifactHandlerManager {
|
public class DefaultArtifactHandlerManager extends AbstractEventSpy implements ArtifactHandlerManager {
|
||||||
|
private final TypeRegistry typeRegistry;
|
||||||
|
|
||||||
private final Map<String, ArtifactHandler> artifactHandlers;
|
private final ConcurrentHashMap<String, ArtifactHandler> allHandlers;
|
||||||
|
|
||||||
private final Map<String, ArtifactHandler> allHandlers = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DefaultArtifactHandlerManager(Map<String, ArtifactHandler> artifactHandlers) {
|
public DefaultArtifactHandlerManager(TypeRegistry typeRegistry) {
|
||||||
this.artifactHandlers = artifactHandlers;
|
this.typeRegistry = requireNonNull(typeRegistry, "null typeRegistry");
|
||||||
|
this.allHandlers = new ConcurrentHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactHandler getArtifactHandler(String type) {
|
@Override
|
||||||
ArtifactHandler handler = allHandlers.get(type);
|
public void onEvent(Object event) {
|
||||||
|
if (event instanceof ExecutionEvent) {
|
||||||
if (handler == null) {
|
ExecutionEvent executionEvent = (ExecutionEvent) event;
|
||||||
handler = artifactHandlers.get(type);
|
if (executionEvent.getType() == ExecutionEvent.Type.SessionEnded) {
|
||||||
|
allHandlers.clear();
|
||||||
if (handler == null) {
|
|
||||||
handler = new DefaultArtifactHandler(type);
|
|
||||||
} else {
|
|
||||||
allHandlers.put(type, handler);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return handler;
|
public ArtifactHandler getArtifactHandler(String id) {
|
||||||
|
return allHandlers.computeIfAbsent(id, k -> {
|
||||||
|
Type type = typeRegistry.getType(id);
|
||||||
|
return new DefaultArtifactHandler(
|
||||||
|
id,
|
||||||
|
type.getExtension(),
|
||||||
|
type.getClassifier(),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
type.isIncludesDependencies(),
|
||||||
|
"none",
|
||||||
|
type.isAddedToClassPath()); // TODO: watch out for module path
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addHandlers(Map<String, ArtifactHandler> handlers) {
|
public void addHandlers(Map<String, ArtifactHandler> handlers) {
|
||||||
// legacy support for maven-gpg-plugin:1.0
|
throw new UnsupportedOperationException("Adding handlers programmatically is not supported anymore");
|
||||||
allHandlers.putAll(handlers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Set<String> getHandlerTypes() {
|
public Set<String> getHandlerTypes() {
|
||||||
return artifactHandlers.keySet();
|
throw new UnsupportedOperationException("Querying handlers programmatically is not supported anymore");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package org.apache.maven.artifact.handler.manager;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||||
|
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
||||||
|
import org.apache.maven.eventspy.AbstractEventSpy;
|
||||||
|
import org.apache.maven.execution.ExecutionEvent;
|
||||||
|
|
||||||
|
import static java.util.Objects.requireNonNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
@Named
|
||||||
|
@Singleton
|
||||||
|
public class LegacyArtifactHandlerManager extends AbstractEventSpy {
|
||||||
|
private final Map<String, ArtifactHandler> artifactHandlers;
|
||||||
|
|
||||||
|
private final Map<String, ArtifactHandler> allHandlers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public LegacyArtifactHandlerManager(Map<String, ArtifactHandler> artifactHandlers) {
|
||||||
|
this.artifactHandlers = requireNonNull(artifactHandlers);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Object event) {
|
||||||
|
if (event instanceof ExecutionEvent) {
|
||||||
|
ExecutionEvent executionEvent = (ExecutionEvent) event;
|
||||||
|
if (executionEvent.getType() == ExecutionEvent.Type.SessionEnded) {
|
||||||
|
allHandlers.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtifactHandler getArtifactHandler(String type) {
|
||||||
|
requireNonNull(type, "null type");
|
||||||
|
ArtifactHandler handler = allHandlers.get(type);
|
||||||
|
if (handler == null) {
|
||||||
|
handler = artifactHandlers.get(type);
|
||||||
|
if (handler == null) {
|
||||||
|
handler = new DefaultArtifactHandler(type);
|
||||||
|
} else {
|
||||||
|
allHandlers.put(type, handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,47 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
package org.apache.maven.artifact.handler.providers;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@code java-source} artifact handler provider.
|
|
||||||
*/
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
package org.apache.maven.artifact.handler.providers;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@code javadoc} artifact handler provider.
|
|
||||||
*/
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
package org.apache.maven.artifact.handler.providers;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@code maven-plugin} artifact handler provider.
|
|
||||||
*/
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
package org.apache.maven.artifact.handler.providers;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@code pom} artifact handler provider.
|
|
||||||
*/
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
package org.apache.maven.artifact.handler.providers;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@code test-jar} artifact handler provider.
|
|
||||||
*/
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -33,6 +33,7 @@
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.maven.RepositoryUtils;
|
import org.apache.maven.RepositoryUtils;
|
||||||
|
import org.apache.maven.api.services.TypeRegistry;
|
||||||
import org.apache.maven.api.xml.XmlNode;
|
import org.apache.maven.api.xml.XmlNode;
|
||||||
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
|
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
|
@ -155,6 +156,8 @@ public class DefaultRepositorySystemSessionFactory {
|
||||||
|
|
||||||
private final RuntimeInformation runtimeInformation;
|
private final RuntimeInformation runtimeInformation;
|
||||||
|
|
||||||
|
private final TypeRegistry typeRegistry;
|
||||||
|
|
||||||
@SuppressWarnings("checkstyle:ParameterNumber")
|
@SuppressWarnings("checkstyle:ParameterNumber")
|
||||||
@Inject
|
@Inject
|
||||||
public DefaultRepositorySystemSessionFactory(
|
public DefaultRepositorySystemSessionFactory(
|
||||||
|
@ -163,13 +166,15 @@ public DefaultRepositorySystemSessionFactory(
|
||||||
@Nullable @Named("ide") WorkspaceReader workspaceRepository,
|
@Nullable @Named("ide") WorkspaceReader workspaceRepository,
|
||||||
SettingsDecrypter settingsDecrypter,
|
SettingsDecrypter settingsDecrypter,
|
||||||
EventSpyDispatcher eventSpyDispatcher,
|
EventSpyDispatcher eventSpyDispatcher,
|
||||||
RuntimeInformation runtimeInformation) {
|
RuntimeInformation runtimeInformation,
|
||||||
|
TypeRegistry typeRegistry) {
|
||||||
this.artifactHandlerManager = artifactHandlerManager;
|
this.artifactHandlerManager = artifactHandlerManager;
|
||||||
this.repoSystem = repoSystem;
|
this.repoSystem = repoSystem;
|
||||||
this.workspaceRepository = workspaceRepository;
|
this.workspaceRepository = workspaceRepository;
|
||||||
this.settingsDecrypter = settingsDecrypter;
|
this.settingsDecrypter = settingsDecrypter;
|
||||||
this.eventSpyDispatcher = eventSpyDispatcher;
|
this.eventSpyDispatcher = eventSpyDispatcher;
|
||||||
this.runtimeInformation = runtimeInformation;
|
this.runtimeInformation = runtimeInformation;
|
||||||
|
this.typeRegistry = typeRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -179,7 +184,8 @@ public RepositorySystemSession newRepositorySession(MavenExecutionRequest reques
|
||||||
|
|
||||||
@SuppressWarnings("checkstyle:methodLength")
|
@SuppressWarnings("checkstyle:methodLength")
|
||||||
public SessionBuilder newRepositorySessionBuilder(MavenExecutionRequest request) {
|
public SessionBuilder newRepositorySessionBuilder(MavenExecutionRequest request) {
|
||||||
SessionBuilder session = MavenRepositorySystemUtils.newSession(repoSystem.createSessionBuilder());
|
SessionBuilder session = MavenRepositorySystemUtils.newSession(
|
||||||
|
repoSystem.createSessionBuilder(), new TypeRegistryAdapter(typeRegistry));
|
||||||
session.setCache(request.getRepositoryCache());
|
session.setCache(request.getRepositoryCache());
|
||||||
|
|
||||||
Map<Object, Object> configProps = new LinkedHashMap<>();
|
Map<Object, Object> configProps = new LinkedHashMap<>();
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package org.apache.maven.internal.aether;
|
||||||
|
|
||||||
|
import org.apache.maven.api.Type;
|
||||||
|
import org.apache.maven.api.services.TypeRegistry;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
import org.eclipse.aether.artifact.ArtifactType;
|
||||||
|
import org.eclipse.aether.artifact.ArtifactTypeRegistry;
|
||||||
|
|
||||||
|
import static java.util.Objects.requireNonNull;
|
||||||
|
|
||||||
|
public class TypeRegistryAdapter implements ArtifactTypeRegistry {
|
||||||
|
private final TypeRegistry typeRegistry;
|
||||||
|
|
||||||
|
public TypeRegistryAdapter(TypeRegistry typeRegistry) {
|
||||||
|
this.typeRegistry = requireNonNull(typeRegistry, "null typeRegistry");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArtifactType get(String typeId) {
|
||||||
|
Type type = typeRegistry.getType(typeId);
|
||||||
|
if (type instanceof ArtifactType) {
|
||||||
|
return (ArtifactType) type;
|
||||||
|
}
|
||||||
|
if (type != null) {
|
||||||
|
return new DefaultType(
|
||||||
|
type.getId(), type.getExtension(), type.getClassifier(), type.getDependencyProperties());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
import org.apache.maven.api.Dependency;
|
import org.apache.maven.api.Dependency;
|
||||||
import org.apache.maven.api.DependencyCoordinate;
|
import org.apache.maven.api.DependencyCoordinate;
|
||||||
|
import org.apache.maven.api.DependencyProperties;
|
||||||
import org.apache.maven.api.Scope;
|
import org.apache.maven.api.Scope;
|
||||||
import org.apache.maven.api.Type;
|
import org.apache.maven.api.Type;
|
||||||
import org.apache.maven.api.Version;
|
import org.apache.maven.api.Version;
|
||||||
|
@ -35,12 +36,15 @@
|
||||||
public class DefaultDependency implements Dependency {
|
public class DefaultDependency implements Dependency {
|
||||||
private final AbstractSession session;
|
private final AbstractSession session;
|
||||||
private final org.eclipse.aether.graph.Dependency dependency;
|
private final org.eclipse.aether.graph.Dependency dependency;
|
||||||
|
private final DependencyProperties dependencyProperties;
|
||||||
private final String key;
|
private final String key;
|
||||||
|
|
||||||
public DefaultDependency(
|
public DefaultDependency(
|
||||||
@Nonnull AbstractSession session, @Nonnull org.eclipse.aether.graph.Dependency dependency) {
|
@Nonnull AbstractSession session, @Nonnull org.eclipse.aether.graph.Dependency dependency) {
|
||||||
this.session = nonNull(session, "session");
|
this.session = nonNull(session, "session");
|
||||||
this.dependency = nonNull(dependency, "dependency");
|
this.dependency = nonNull(dependency, "dependency");
|
||||||
|
this.dependencyProperties =
|
||||||
|
new DefaultDependencyProperties(dependency.getArtifact().getProperties());
|
||||||
this.key = getGroupId()
|
this.key = getGroupId()
|
||||||
+ ':'
|
+ ':'
|
||||||
+ getArtifactId()
|
+ getArtifactId()
|
||||||
|
@ -94,6 +98,11 @@ public Type getType() {
|
||||||
return session.getService(TypeRegistry.class).getType(type);
|
return session.getService(TypeRegistry.class).getType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DependencyProperties getDependencyProperties() {
|
||||||
|
return dependencyProperties;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSnapshot() {
|
public boolean isSnapshot() {
|
||||||
return DefaultVersionParser.checkSnapshot(dependency.getArtifact().getVersion());
|
return DefaultVersionParser.checkSnapshot(dependency.getArtifact().getVersion());
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package org.apache.maven.internal.impl;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.maven.api.DependencyProperties;
|
||||||
|
import org.apache.maven.api.annotations.Nonnull;
|
||||||
|
|
||||||
|
import static org.apache.maven.internal.impl.Utils.nonNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default implementation of artifact properties.
|
||||||
|
*/
|
||||||
|
public class DefaultDependencyProperties implements DependencyProperties {
|
||||||
|
private final Map<String, String> properties;
|
||||||
|
|
||||||
|
public DefaultDependencyProperties(String... flags) {
|
||||||
|
this(Arrays.asList(flags));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultDependencyProperties(@Nonnull Collection<String> flags) {
|
||||||
|
nonNull(flags, "null flags");
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
for (String flag : flags) {
|
||||||
|
map.put(flag, Boolean.TRUE.toString());
|
||||||
|
}
|
||||||
|
this.properties = Collections.unmodifiableMap(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultDependencyProperties(@Nonnull Map<String, String> properties) {
|
||||||
|
this.properties = Collections.unmodifiableMap(nonNull(properties, "null properties"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public Map<String, String> asMap() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkFlag(@Nonnull String flag) {
|
||||||
|
nonNull(flag, "null flag");
|
||||||
|
return Boolean.parseBoolean(properties.getOrDefault(flag, ""));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package org.apache.maven.internal.impl;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.maven.api.DependencyProperties;
|
||||||
|
import org.apache.maven.api.Type;
|
||||||
|
import org.eclipse.aether.artifact.ArtifactProperties;
|
||||||
|
import org.eclipse.aether.artifact.ArtifactType;
|
||||||
|
|
||||||
|
import static org.apache.maven.internal.impl.Utils.nonNull;
|
||||||
|
|
||||||
|
public class DefaultType implements Type, ArtifactType {
|
||||||
|
private final String extension;
|
||||||
|
|
||||||
|
private final String classifier;
|
||||||
|
|
||||||
|
private final DependencyProperties dependencyProperties;
|
||||||
|
|
||||||
|
public DefaultType(String id, String extension, String classifier, DependencyProperties dependencyProperties) {
|
||||||
|
nonNull(id, "null id");
|
||||||
|
this.extension = nonNull(extension, "null extension");
|
||||||
|
this.classifier = classifier;
|
||||||
|
nonNull(dependencyProperties, "null dependencyProperties");
|
||||||
|
HashMap<String, String> props = new HashMap<>(dependencyProperties.asMap());
|
||||||
|
props.put(ArtifactProperties.TYPE, id);
|
||||||
|
this.dependencyProperties = new DefaultDependencyProperties(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return dependencyProperties.asMap().get(ArtifactProperties.TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getExtension() {
|
||||||
|
return extension;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getClassifier() {
|
||||||
|
return classifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DependencyProperties getDependencyProperties() {
|
||||||
|
return dependencyProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getProperties() {
|
||||||
|
return getDependencyProperties().asMap();
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,59 +22,77 @@
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import org.apache.maven.api.DependencyProperties;
|
||||||
import org.apache.maven.api.Type;
|
import org.apache.maven.api.Type;
|
||||||
import org.apache.maven.api.annotations.Nonnull;
|
import org.apache.maven.api.annotations.Nonnull;
|
||||||
import org.apache.maven.api.services.TypeRegistry;
|
import org.apache.maven.api.services.TypeRegistry;
|
||||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||||
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
|
import org.apache.maven.artifact.handler.manager.LegacyArtifactHandlerManager;
|
||||||
|
import org.apache.maven.eventspy.AbstractEventSpy;
|
||||||
|
import org.apache.maven.execution.ExecutionEvent;
|
||||||
|
|
||||||
import static org.apache.maven.internal.impl.Utils.nonNull;
|
import static org.apache.maven.internal.impl.Utils.nonNull;
|
||||||
|
|
||||||
@Named
|
@Named
|
||||||
@Singleton
|
@Singleton
|
||||||
public class DefaultTypeRegistry implements TypeRegistry {
|
public class DefaultTypeRegistry extends AbstractEventSpy implements TypeRegistry {
|
||||||
|
private final Map<String, Type> types;
|
||||||
|
|
||||||
private final ArtifactHandlerManager manager;
|
private final ConcurrentHashMap<String, Type> usedTypes;
|
||||||
|
|
||||||
|
private final ConcurrentHashMap<String, Type> legacyTypes;
|
||||||
|
|
||||||
|
private final LegacyArtifactHandlerManager manager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DefaultTypeRegistry(ArtifactHandlerManager manager) {
|
public DefaultTypeRegistry(Map<String, Type> types, LegacyArtifactHandlerManager manager) {
|
||||||
|
this.types = nonNull(types, "types");
|
||||||
|
this.usedTypes = new ConcurrentHashMap<>();
|
||||||
|
this.legacyTypes = new ConcurrentHashMap<>();
|
||||||
this.manager = nonNull(manager, "artifactHandlerManager");
|
this.manager = nonNull(manager, "artifactHandlerManager");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Object event) {
|
||||||
|
if (event instanceof ExecutionEvent) {
|
||||||
|
ExecutionEvent executionEvent = (ExecutionEvent) event;
|
||||||
|
if (executionEvent.getType() == ExecutionEvent.Type.SessionEnded) {
|
||||||
|
usedTypes.clear();
|
||||||
|
legacyTypes.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public Type getType(String id) {
|
public Type getType(String id) {
|
||||||
// Copy data as the ArtifacHandler is not immutable, but Type should be.
|
nonNull(id, "null id");
|
||||||
ArtifactHandler handler = manager.getArtifactHandler(nonNull(id, "id"));
|
return usedTypes.computeIfAbsent(id, i -> {
|
||||||
String extension = handler.getExtension();
|
Type type = types.get(id);
|
||||||
String classifier = handler.getClassifier();
|
if (type == null) {
|
||||||
boolean includeDependencies = handler.isIncludesDependencies();
|
// legacy types ALWAYS return type (AHM never returns null)
|
||||||
boolean addedToClasspath = handler.isAddedToClasspath();
|
type = legacyTypes.computeIfAbsent(id, k -> {
|
||||||
return new Type() {
|
// Copy data as the ArtifactHandler is not immutable, but Type should be.
|
||||||
@Override
|
ArtifactHandler handler = manager.getArtifactHandler(id);
|
||||||
public String getId() {
|
ArrayList<String> flags = new ArrayList<>();
|
||||||
return id;
|
if (handler.isAddedToClasspath()) {
|
||||||
|
flags.add(DependencyProperties.FLAG_CLASS_PATH_CONSTITUENT);
|
||||||
|
}
|
||||||
|
if (handler.isIncludesDependencies()) {
|
||||||
|
flags.add(DependencyProperties.FLAG_INCLUDES_DEPENDENCIES);
|
||||||
|
}
|
||||||
|
return new DefaultType(
|
||||||
|
id,
|
||||||
|
handler.getExtension(),
|
||||||
|
handler.getClassifier(),
|
||||||
|
new DefaultDependencyProperties(flags));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
return type;
|
||||||
@Override
|
});
|
||||||
public String getExtension() {
|
|
||||||
return extension;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getClassifier() {
|
|
||||||
return classifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isIncludesDependencies() {
|
|
||||||
return includeDependencies;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAddedToClasspath() {
|
|
||||||
return addedToClasspath;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,31 +16,29 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.maven.artifact.handler.providers;
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
import org.apache.maven.api.Type;
|
||||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
/**
|
@Named(BomTypeProvider.NAME)
|
||||||
* {@code rar} artifact handler provider.
|
|
||||||
*/
|
|
||||||
@Named("rar")
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class RarArtifactHandlerProvider implements Provider<ArtifactHandler> {
|
public class BomTypeProvider implements Provider<Type> {
|
||||||
private final ArtifactHandler artifactHandler;
|
public static final String NAME = "bom";
|
||||||
|
|
||||||
@Inject
|
private final Type type;
|
||||||
public RarArtifactHandlerProvider() {
|
|
||||||
this.artifactHandler = new DefaultArtifactHandler("rar", null, null, null, null, true, "java", false);
|
public BomTypeProvider() {
|
||||||
|
this.type = new DefaultType(NAME, "pom", null, new DefaultDependencyProperties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArtifactHandler get() {
|
public Type get() {
|
||||||
return artifactHandler;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,31 +16,31 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.maven.artifact.handler.providers;
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
import org.apache.maven.api.DependencyProperties;
|
||||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
import org.apache.maven.api.Type;
|
||||||
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
/**
|
@Named(EarTypeProvider.NAME)
|
||||||
* {@code bom} artifact handler provider.
|
|
||||||
*/
|
|
||||||
@Named("bom")
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class BomArtifactHandlerProvider implements Provider<ArtifactHandler> {
|
public class EarTypeProvider implements Provider<Type> {
|
||||||
private final ArtifactHandler artifactHandler;
|
public static final String NAME = "ear";
|
||||||
|
|
||||||
@Inject
|
private final Type type;
|
||||||
public BomArtifactHandlerProvider() {
|
|
||||||
this.artifactHandler = new DefaultArtifactHandler("pom", null, null, null, null, false, "none", false);
|
public EarTypeProvider() {
|
||||||
|
this.type = new DefaultType(
|
||||||
|
NAME, "ear", null, new DefaultDependencyProperties(DependencyProperties.FLAG_INCLUDES_DEPENDENCIES));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArtifactHandler get() {
|
public Type get() {
|
||||||
return artifactHandler;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Provider;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.apache.maven.api.DependencyProperties;
|
||||||
|
import org.apache.maven.api.Type;
|
||||||
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
|
@Named(EjbClientTypeProvider.NAME)
|
||||||
|
@Singleton
|
||||||
|
public class EjbClientTypeProvider implements Provider<Type> {
|
||||||
|
public static final String NAME = "ejb-client";
|
||||||
|
|
||||||
|
private final Type type;
|
||||||
|
|
||||||
|
public EjbClientTypeProvider() {
|
||||||
|
this.type = new DefaultType(
|
||||||
|
NAME,
|
||||||
|
"jar",
|
||||||
|
"client",
|
||||||
|
new DefaultDependencyProperties(DependencyProperties.FLAG_CLASS_PATH_CONSTITUENT));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type get() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Provider;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.apache.maven.api.DependencyProperties;
|
||||||
|
import org.apache.maven.api.Type;
|
||||||
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
|
@Named(EjbTypeProvider.NAME)
|
||||||
|
@Singleton
|
||||||
|
public class EjbTypeProvider implements Provider<Type> {
|
||||||
|
public static final String NAME = "ejb";
|
||||||
|
|
||||||
|
private final Type type;
|
||||||
|
|
||||||
|
public EjbTypeProvider() {
|
||||||
|
this.type = new DefaultType(
|
||||||
|
NAME, "jar", null, new DefaultDependencyProperties(DependencyProperties.FLAG_CLASS_PATH_CONSTITUENT));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type get() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Provider;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.apache.maven.api.DependencyProperties;
|
||||||
|
import org.apache.maven.api.Type;
|
||||||
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
|
@Named(JarTypeProvider.NAME)
|
||||||
|
@Singleton
|
||||||
|
public class JarTypeProvider implements Provider<Type> {
|
||||||
|
public static final String NAME = "jar";
|
||||||
|
|
||||||
|
private final Type type;
|
||||||
|
|
||||||
|
public JarTypeProvider() {
|
||||||
|
this.type = new DefaultType(
|
||||||
|
NAME, "jar", null, new DefaultDependencyProperties(DependencyProperties.FLAG_CLASS_PATH_CONSTITUENT));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type get() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,31 +16,29 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.maven.artifact.handler.providers;
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
import org.apache.maven.api.Type;
|
||||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
/**
|
@Named(JavaSourceTypeProvider.NAME)
|
||||||
* {@code ear} artifact handler provider.
|
|
||||||
*/
|
|
||||||
@Named("ear")
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class EarArtifactHandlerProvider implements Provider<ArtifactHandler> {
|
public class JavaSourceTypeProvider implements Provider<Type> {
|
||||||
private final ArtifactHandler artifactHandler;
|
public static final String NAME = "java-source";
|
||||||
|
|
||||||
@Inject
|
private final Type type;
|
||||||
public EarArtifactHandlerProvider() {
|
|
||||||
this.artifactHandler = new DefaultArtifactHandler("ear", null, null, null, null, true, "java", false);
|
public JavaSourceTypeProvider() {
|
||||||
|
this.type = new DefaultType(NAME, "jar", "sources", new DefaultDependencyProperties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArtifactHandler get() {
|
public Type get() {
|
||||||
return artifactHandler;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Provider;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.apache.maven.api.DependencyProperties;
|
||||||
|
import org.apache.maven.api.Type;
|
||||||
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
|
@Named(JavadocTypeProvider.NAME)
|
||||||
|
@Singleton
|
||||||
|
public class JavadocTypeProvider implements Provider<Type> {
|
||||||
|
public static final String NAME = "javadoc";
|
||||||
|
|
||||||
|
private final Type type;
|
||||||
|
|
||||||
|
public JavadocTypeProvider() {
|
||||||
|
this.type = new DefaultType(
|
||||||
|
NAME,
|
||||||
|
"jar",
|
||||||
|
"javadoc",
|
||||||
|
new DefaultDependencyProperties(DependencyProperties.FLAG_CLASS_PATH_CONSTITUENT));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type get() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Provider;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.apache.maven.api.DependencyProperties;
|
||||||
|
import org.apache.maven.api.Type;
|
||||||
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
|
@Named(MavenPluginTypeProvider.NAME)
|
||||||
|
@Singleton
|
||||||
|
public class MavenPluginTypeProvider implements Provider<Type> {
|
||||||
|
public static final String NAME = "maven-plugin";
|
||||||
|
|
||||||
|
private final Type type;
|
||||||
|
|
||||||
|
public MavenPluginTypeProvider() {
|
||||||
|
this.type = new DefaultType(
|
||||||
|
NAME, "jar", null, new DefaultDependencyProperties(DependencyProperties.FLAG_CLASS_PATH_CONSTITUENT));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type get() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,31 +16,31 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.maven.artifact.handler.providers;
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
import org.apache.maven.api.DependencyProperties;
|
||||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
import org.apache.maven.api.Type;
|
||||||
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
/**
|
@Named(ParTypeProvider.NAME)
|
||||||
* {@code ejb} artifact handler provider.
|
|
||||||
*/
|
|
||||||
@Named("ejb")
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class EjbArtifactHandlerProvider implements Provider<ArtifactHandler> {
|
public class ParTypeProvider implements Provider<Type> {
|
||||||
private final ArtifactHandler artifactHandler;
|
public static final String NAME = "par";
|
||||||
|
|
||||||
@Inject
|
private final Type type;
|
||||||
public EjbArtifactHandlerProvider() {
|
|
||||||
this.artifactHandler = new DefaultArtifactHandler("ejb", "jar", null, null, null, false, "java", true);
|
public ParTypeProvider() {
|
||||||
|
this.type = new DefaultType(
|
||||||
|
NAME, "par", null, new DefaultDependencyProperties(DependencyProperties.FLAG_INCLUDES_DEPENDENCIES));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArtifactHandler get() {
|
public Type get() {
|
||||||
return artifactHandler;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,31 +16,29 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.maven.artifact.handler.providers;
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
import org.apache.maven.api.Type;
|
||||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
/**
|
@Named(PomTypeProvider.NAME)
|
||||||
* {@code war} artifact handler provider.
|
|
||||||
*/
|
|
||||||
@Named("war")
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class WarArtifactHandlerProvider implements Provider<ArtifactHandler> {
|
public class PomTypeProvider implements Provider<Type> {
|
||||||
private final ArtifactHandler artifactHandler;
|
public static final String NAME = "pom";
|
||||||
|
|
||||||
@Inject
|
private final Type type;
|
||||||
public WarArtifactHandlerProvider() {
|
|
||||||
this.artifactHandler = new DefaultArtifactHandler("war", null, null, null, null, true, "java", false);
|
public PomTypeProvider() {
|
||||||
|
this.type = new DefaultType(NAME, "pom", null, new DefaultDependencyProperties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArtifactHandler get() {
|
public Type get() {
|
||||||
return artifactHandler;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,31 +16,31 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.maven.artifact.handler.providers;
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
import org.apache.maven.api.DependencyProperties;
|
||||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
import org.apache.maven.api.Type;
|
||||||
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
/**
|
@Named(RarTypeProvider.NAME)
|
||||||
* {@code jar} artifact handler provider.
|
|
||||||
*/
|
|
||||||
@Named("jar")
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class JarArtifactHandlerProvider implements Provider<ArtifactHandler> {
|
public class RarTypeProvider implements Provider<Type> {
|
||||||
private final ArtifactHandler artifactHandler;
|
public static final String NAME = "rar";
|
||||||
|
|
||||||
@Inject
|
private final Type type;
|
||||||
public JarArtifactHandlerProvider() {
|
|
||||||
this.artifactHandler = new DefaultArtifactHandler("jar", null, null, null, null, false, "java", true);
|
public RarTypeProvider() {
|
||||||
|
this.type = new DefaultType(
|
||||||
|
NAME, "rar", null, new DefaultDependencyProperties(DependencyProperties.FLAG_INCLUDES_DEPENDENCIES));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArtifactHandler get() {
|
public Type get() {
|
||||||
return artifactHandler;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,32 +16,34 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.maven.artifact.handler.providers;
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
import org.apache.maven.api.DependencyProperties;
|
||||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
import org.apache.maven.api.Type;
|
||||||
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
/**
|
@Named(TestJarTypeProvider.NAME)
|
||||||
* {@code ejb-client} artifact handler provider.
|
|
||||||
*/
|
|
||||||
@Named("ejb-client")
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class EjbClientArtifactHandlerProvider implements Provider<ArtifactHandler> {
|
public class TestJarTypeProvider implements Provider<Type> {
|
||||||
private final ArtifactHandler artifactHandler;
|
public static final String NAME = "test-jar";
|
||||||
|
|
||||||
@Inject
|
private final Type type;
|
||||||
public EjbClientArtifactHandlerProvider() {
|
|
||||||
this.artifactHandler =
|
public TestJarTypeProvider() {
|
||||||
new DefaultArtifactHandler("ejb-client", "jar", "client", null, "ejb", false, "java", true);
|
this.type = new DefaultType(
|
||||||
|
NAME,
|
||||||
|
"jar",
|
||||||
|
"tests",
|
||||||
|
new DefaultDependencyProperties(DependencyProperties.FLAG_CLASS_PATH_CONSTITUENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArtifactHandler get() {
|
public Type get() {
|
||||||
return artifactHandler;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package org.apache.maven.internal.impl.types;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Provider;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.apache.maven.api.DependencyProperties;
|
||||||
|
import org.apache.maven.api.Type;
|
||||||
|
import org.apache.maven.internal.impl.DefaultDependencyProperties;
|
||||||
|
import org.apache.maven.internal.impl.DefaultType;
|
||||||
|
|
||||||
|
@Named(WarTypeProvider.NAME)
|
||||||
|
@Singleton
|
||||||
|
public class WarTypeProvider implements Provider<Type> {
|
||||||
|
public static final String NAME = "war";
|
||||||
|
|
||||||
|
private final Type type;
|
||||||
|
|
||||||
|
public WarTypeProvider() {
|
||||||
|
this.type = new DefaultType(
|
||||||
|
NAME, "war", null, new DefaultDependencyProperties(DependencyProperties.FLAG_INCLUDES_DEPENDENCIES));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type get() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,6 +24,7 @@
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
|
||||||
import org.codehaus.plexus.PlexusContainer;
|
import org.codehaus.plexus.PlexusContainer;
|
||||||
import org.codehaus.plexus.testing.PlexusTest;
|
import org.codehaus.plexus.testing.PlexusTest;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -72,11 +73,14 @@ void testAptConsistency() throws Exception {
|
||||||
String addedToClasspath = trimApt(cols[6]);
|
String addedToClasspath = trimApt(cols[6]);
|
||||||
String includesDependencies = trimApt(cols[7]);
|
String includesDependencies = trimApt(cols[7]);
|
||||||
|
|
||||||
ArtifactHandler handler = container.lookup(ArtifactHandler.class, type);
|
ArtifactHandler handler =
|
||||||
|
container.lookup(ArtifactHandlerManager.class).getArtifactHandler(type);
|
||||||
assertEquals(handler.getExtension(), extension, type + " extension");
|
assertEquals(handler.getExtension(), extension, type + " extension");
|
||||||
assertEquals(handler.getPackaging(), packaging, type + " packaging");
|
// Packaging/Directory is Maven1 remnant!!!
|
||||||
|
// assertEquals(handler.getPackaging(), packaging, type + " packaging");
|
||||||
assertEquals(handler.getClassifier(), classifier, type + " classifier");
|
assertEquals(handler.getClassifier(), classifier, type + " classifier");
|
||||||
assertEquals(handler.getLanguage(), language, type + " language");
|
// Language is unused
|
||||||
|
// assertEquals(handler.getLanguage(), language, type + " language");
|
||||||
assertEquals(
|
assertEquals(
|
||||||
handler.isAddedToClasspath() ? "true" : null, addedToClasspath, type + " addedToClasspath");
|
handler.isAddedToClasspath() ? "true" : null, addedToClasspath, type + " addedToClasspath");
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
import org.apache.maven.eventspy.internal.EventSpyDispatcher;
|
import org.apache.maven.eventspy.internal.EventSpyDispatcher;
|
||||||
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
|
import org.apache.maven.internal.impl.DefaultTypeRegistry;
|
||||||
import org.apache.maven.rtinfo.RuntimeInformation;
|
import org.apache.maven.rtinfo.RuntimeInformation;
|
||||||
import org.apache.maven.settings.Server;
|
import org.apache.maven.settings.Server;
|
||||||
import org.apache.maven.settings.crypto.SettingsDecrypter;
|
import org.apache.maven.settings.crypto.SettingsDecrypter;
|
||||||
|
@ -72,6 +73,9 @@ public class DefaultRepositorySystemSessionFactoryTest {
|
||||||
@Inject
|
@Inject
|
||||||
protected RuntimeInformation information;
|
protected RuntimeInformation information;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected DefaultTypeRegistry defaultTypeRegistry;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void isNoSnapshotUpdatesTest() throws InvalidRepositoryException {
|
void isNoSnapshotUpdatesTest() throws InvalidRepositoryException {
|
||||||
DefaultRepositorySystemSessionFactory systemSessionFactory = new DefaultRepositorySystemSessionFactory(
|
DefaultRepositorySystemSessionFactory systemSessionFactory = new DefaultRepositorySystemSessionFactory(
|
||||||
|
@ -80,7 +84,8 @@ void isNoSnapshotUpdatesTest() throws InvalidRepositoryException {
|
||||||
null,
|
null,
|
||||||
settingsDecrypter,
|
settingsDecrypter,
|
||||||
eventSpyDispatcher,
|
eventSpyDispatcher,
|
||||||
information);
|
information,
|
||||||
|
defaultTypeRegistry);
|
||||||
|
|
||||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
|
||||||
request.setLocalRepository(getLocalRepository());
|
request.setLocalRepository(getLocalRepository());
|
||||||
|
@ -102,7 +107,8 @@ void isSnapshotUpdatesTest() throws InvalidRepositoryException {
|
||||||
null,
|
null,
|
||||||
settingsDecrypter,
|
settingsDecrypter,
|
||||||
eventSpyDispatcher,
|
eventSpyDispatcher,
|
||||||
information);
|
information,
|
||||||
|
defaultTypeRegistry);
|
||||||
|
|
||||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
|
||||||
request.setLocalRepository(getLocalRepository());
|
request.setLocalRepository(getLocalRepository());
|
||||||
|
@ -136,7 +142,8 @@ void wagonProviderConfigurationTest() throws InvalidRepositoryException {
|
||||||
null,
|
null,
|
||||||
settingsDecrypter,
|
settingsDecrypter,
|
||||||
eventSpyDispatcher,
|
eventSpyDispatcher,
|
||||||
information);
|
information,
|
||||||
|
defaultTypeRegistry);
|
||||||
|
|
||||||
PlexusConfiguration plexusConfiguration = (PlexusConfiguration) systemSessionFactory
|
PlexusConfiguration plexusConfiguration = (PlexusConfiguration) systemSessionFactory
|
||||||
.newRepositorySession(request)
|
.newRepositorySession(request)
|
||||||
|
@ -178,7 +185,8 @@ void httpConfigurationWithHttpHeadersTest() throws InvalidRepositoryException {
|
||||||
null,
|
null,
|
||||||
settingsDecrypter,
|
settingsDecrypter,
|
||||||
eventSpyDispatcher,
|
eventSpyDispatcher,
|
||||||
information);
|
information,
|
||||||
|
defaultTypeRegistry);
|
||||||
|
|
||||||
Map<String, String> headers = (Map<String, String>) systemSessionFactory
|
Map<String, String> headers = (Map<String, String>) systemSessionFactory
|
||||||
.newRepositorySession(request)
|
.newRepositorySession(request)
|
||||||
|
@ -214,7 +222,8 @@ void connectTimeoutConfigurationTest() throws InvalidRepositoryException {
|
||||||
null,
|
null,
|
||||||
settingsDecrypter,
|
settingsDecrypter,
|
||||||
eventSpyDispatcher,
|
eventSpyDispatcher,
|
||||||
information);
|
information,
|
||||||
|
defaultTypeRegistry);
|
||||||
|
|
||||||
int connectionTimeout = (Integer) systemSessionFactory
|
int connectionTimeout = (Integer) systemSessionFactory
|
||||||
.newRepositorySession(request)
|
.newRepositorySession(request)
|
||||||
|
@ -254,7 +263,8 @@ void connectionTimeoutFromHttpConfigurationTest() throws InvalidRepositoryExcept
|
||||||
null,
|
null,
|
||||||
settingsDecrypter,
|
settingsDecrypter,
|
||||||
eventSpyDispatcher,
|
eventSpyDispatcher,
|
||||||
information);
|
information,
|
||||||
|
defaultTypeRegistry);
|
||||||
|
|
||||||
int connectionTimeout = (Integer) systemSessionFactory
|
int connectionTimeout = (Integer) systemSessionFactory
|
||||||
.newRepositorySession(request)
|
.newRepositorySession(request)
|
||||||
|
@ -288,7 +298,8 @@ void requestTimeoutConfigurationTest() throws InvalidRepositoryException {
|
||||||
null,
|
null,
|
||||||
settingsDecrypter,
|
settingsDecrypter,
|
||||||
eventSpyDispatcher,
|
eventSpyDispatcher,
|
||||||
information);
|
information,
|
||||||
|
defaultTypeRegistry);
|
||||||
|
|
||||||
int requestTimeout = (Integer) systemSessionFactory
|
int requestTimeout = (Integer) systemSessionFactory
|
||||||
.newRepositorySession(request)
|
.newRepositorySession(request)
|
||||||
|
@ -328,7 +339,8 @@ void readTimeoutFromHttpConfigurationTest() throws InvalidRepositoryException {
|
||||||
null,
|
null,
|
||||||
settingsDecrypter,
|
settingsDecrypter,
|
||||||
eventSpyDispatcher,
|
eventSpyDispatcher,
|
||||||
information);
|
information,
|
||||||
|
defaultTypeRegistry);
|
||||||
|
|
||||||
int requestTimeout = (Integer) systemSessionFactory
|
int requestTimeout = (Integer) systemSessionFactory
|
||||||
.newRepositorySession(request)
|
.newRepositorySession(request)
|
||||||
|
@ -345,7 +357,8 @@ void transportConfigurationTest() throws InvalidRepositoryException {
|
||||||
null,
|
null,
|
||||||
settingsDecrypter,
|
settingsDecrypter,
|
||||||
eventSpyDispatcher,
|
eventSpyDispatcher,
|
||||||
information);
|
information,
|
||||||
|
defaultTypeRegistry);
|
||||||
|
|
||||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
|
||||||
request.setLocalRepository(getLocalRepository());
|
request.setLocalRepository(getLocalRepository());
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import org.eclipse.aether.DefaultRepositorySystemSession;
|
import org.eclipse.aether.DefaultRepositorySystemSession;
|
||||||
import org.eclipse.aether.RepositorySystemSession.SessionBuilder;
|
import org.eclipse.aether.RepositorySystemSession.SessionBuilder;
|
||||||
|
import org.eclipse.aether.artifact.ArtifactTypeRegistry;
|
||||||
import org.eclipse.aether.artifact.DefaultArtifactType;
|
import org.eclipse.aether.artifact.DefaultArtifactType;
|
||||||
import org.eclipse.aether.collection.DependencyGraphTransformer;
|
import org.eclipse.aether.collection.DependencyGraphTransformer;
|
||||||
import org.eclipse.aether.collection.DependencyManager;
|
import org.eclipse.aether.collection.DependencyManager;
|
||||||
|
@ -41,6 +42,8 @@
|
||||||
import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
|
import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
|
||||||
import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
|
import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
|
||||||
|
|
||||||
|
import static java.util.Objects.requireNonNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A utility class to assist in setting up a Maven-like repository system. <em>Note:</em> This component is meant to
|
* A utility class to assist in setting up a Maven-like repository system. <em>Note:</em> This component is meant to
|
||||||
* assist those clients that employ the repository system outside of an IoC container, Maven plugins should instead
|
* assist those clients that employ the repository system outside of an IoC container, Maven plugins should instead
|
||||||
|
@ -54,13 +57,11 @@ private MavenRepositorySystemUtils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Maven-like repository system session by initializing the session with values typical for
|
* This method is deprecated, nobody should use it.
|
||||||
* Maven-based resolution. In more detail, this method configures settings relevant for the processing of dependency
|
|
||||||
* graphs, most other settings remain at their generic default value. Use the various setters to further configure
|
|
||||||
* the session with authentication, mirror, proxy and other information required for your environment.
|
|
||||||
*
|
*
|
||||||
* @return The new repository system session, never {@code null}.
|
* @deprecated This method is here only for legacy uses (like UTs), nothing else should use it.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static DefaultRepositorySystemSession newSession() {
|
public static DefaultRepositorySystemSession newSession() {
|
||||||
DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
|
DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
|
||||||
|
|
||||||
|
@ -82,6 +83,19 @@ public static DefaultRepositorySystemSession newSession() {
|
||||||
transformer = new ChainedDependencyGraphTransformer(transformer, new JavaDependencyContextRefiner());
|
transformer = new ChainedDependencyGraphTransformer(transformer, new JavaDependencyContextRefiner());
|
||||||
session.setDependencyGraphTransformer(transformer);
|
session.setDependencyGraphTransformer(transformer);
|
||||||
|
|
||||||
|
session.setArtifactTypeRegistry(newArtifactTypeRegistry());
|
||||||
|
|
||||||
|
session.setArtifactDescriptorPolicy(new SimpleArtifactDescriptorPolicy(true, true));
|
||||||
|
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates new Maven-like {@link ArtifactTypeRegistry}. This method should not be used from Maven.
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public static ArtifactTypeRegistry newArtifactTypeRegistry() {
|
||||||
DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry();
|
DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry();
|
||||||
stereotypes.add(new DefaultArtifactType("pom"));
|
stereotypes.add(new DefaultArtifactType("pom"));
|
||||||
stereotypes.add(new DefaultArtifactType("maven-plugin", "jar", "", "java"));
|
stereotypes.add(new DefaultArtifactType("maven-plugin", "jar", "", "java"));
|
||||||
|
@ -95,11 +109,7 @@ public static DefaultRepositorySystemSession newSession() {
|
||||||
stereotypes.add(new DefaultArtifactType("ear", "ear", "", "java", false, true));
|
stereotypes.add(new DefaultArtifactType("ear", "ear", "", "java", false, true));
|
||||||
stereotypes.add(new DefaultArtifactType("rar", "rar", "", "java", false, true));
|
stereotypes.add(new DefaultArtifactType("rar", "rar", "", "java", false, true));
|
||||||
stereotypes.add(new DefaultArtifactType("par", "par", "", "java", false, true));
|
stereotypes.add(new DefaultArtifactType("par", "par", "", "java", false, true));
|
||||||
session.setArtifactTypeRegistry(stereotypes);
|
return stereotypes;
|
||||||
|
|
||||||
session.setArtifactDescriptorPolicy(new SimpleArtifactDescriptorPolicy(true, true));
|
|
||||||
|
|
||||||
return session;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,8 +119,12 @@ public static DefaultRepositorySystemSession newSession() {
|
||||||
* the session with authentication, mirror, proxy and other information required for your environment.
|
* the session with authentication, mirror, proxy and other information required for your environment.
|
||||||
*
|
*
|
||||||
* @return The new repository system session, never {@code null}.
|
* @return The new repository system session, never {@code null}.
|
||||||
|
* @since 4.0.0
|
||||||
*/
|
*/
|
||||||
public static SessionBuilder newSession(SessionBuilder session) {
|
public static SessionBuilder newSession(SessionBuilder session, ArtifactTypeRegistry artifactTypeRegistry) {
|
||||||
|
requireNonNull(session, "null sessionBuilder");
|
||||||
|
requireNonNull(artifactTypeRegistry, "null artifactTypeRegistry");
|
||||||
|
|
||||||
DependencyTraverser depTraverser = new FatArtifactTraverser();
|
DependencyTraverser depTraverser = new FatArtifactTraverser();
|
||||||
session.setDependencyTraverser(depTraverser);
|
session.setDependencyTraverser(depTraverser);
|
||||||
|
|
||||||
|
@ -128,21 +142,7 @@ public static SessionBuilder newSession(SessionBuilder session) {
|
||||||
new SimpleOptionalitySelector(), new JavaScopeDeriver());
|
new SimpleOptionalitySelector(), new JavaScopeDeriver());
|
||||||
transformer = new ChainedDependencyGraphTransformer(transformer, new JavaDependencyContextRefiner());
|
transformer = new ChainedDependencyGraphTransformer(transformer, new JavaDependencyContextRefiner());
|
||||||
session.setDependencyGraphTransformer(transformer);
|
session.setDependencyGraphTransformer(transformer);
|
||||||
|
session.setArtifactTypeRegistry(artifactTypeRegistry);
|
||||||
DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry();
|
|
||||||
stereotypes.add(new DefaultArtifactType("pom"));
|
|
||||||
stereotypes.add(new DefaultArtifactType("maven-plugin", "jar", "", "java"));
|
|
||||||
stereotypes.add(new DefaultArtifactType("jar", "jar", "", "java"));
|
|
||||||
stereotypes.add(new DefaultArtifactType("ejb", "jar", "", "java"));
|
|
||||||
stereotypes.add(new DefaultArtifactType("ejb-client", "jar", "client", "java"));
|
|
||||||
stereotypes.add(new DefaultArtifactType("test-jar", "jar", "tests", "java"));
|
|
||||||
stereotypes.add(new DefaultArtifactType("javadoc", "jar", "javadoc", "java"));
|
|
||||||
stereotypes.add(new DefaultArtifactType("java-source", "jar", "sources", "java", false, false));
|
|
||||||
stereotypes.add(new DefaultArtifactType("war", "war", "", "java", false, true));
|
|
||||||
stereotypes.add(new DefaultArtifactType("ear", "ear", "", "java", false, true));
|
|
||||||
stereotypes.add(new DefaultArtifactType("rar", "rar", "", "java", false, true));
|
|
||||||
stereotypes.add(new DefaultArtifactType("par", "par", "", "java", false, true));
|
|
||||||
session.setArtifactTypeRegistry(stereotypes);
|
|
||||||
|
|
||||||
session.setArtifactDescriptorPolicy(new SimpleArtifactDescriptorPolicy(true, true));
|
session.setArtifactDescriptorPolicy(new SimpleArtifactDescriptorPolicy(true, true));
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
import org.apache.maven.repository.internal.util.ConsoleTransferListener;
|
import org.apache.maven.repository.internal.util.ConsoleTransferListener;
|
||||||
import org.codehaus.plexus.PlexusContainer;
|
import org.codehaus.plexus.PlexusContainer;
|
||||||
import org.codehaus.plexus.testing.PlexusTest;
|
import org.codehaus.plexus.testing.PlexusTest;
|
||||||
import org.eclipse.aether.DefaultRepositorySystemSession;
|
|
||||||
import org.eclipse.aether.RepositorySystem;
|
import org.eclipse.aether.RepositorySystem;
|
||||||
import org.eclipse.aether.RepositorySystemSession;
|
import org.eclipse.aether.RepositorySystemSession;
|
||||||
|
import org.eclipse.aether.RepositorySystemSession.SessionBuilder;
|
||||||
import org.eclipse.aether.repository.LocalRepository;
|
import org.eclipse.aether.repository.LocalRepository;
|
||||||
import org.eclipse.aether.repository.RemoteRepository;
|
import org.eclipse.aether.repository.RemoteRepository;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
@ -55,15 +55,14 @@ protected PlexusContainer getContainer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RepositorySystemSession newMavenRepositorySystemSession(RepositorySystem system) {
|
public static RepositorySystemSession newMavenRepositorySystemSession(RepositorySystem system) {
|
||||||
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
|
SessionBuilder session = MavenRepositorySystemUtils.newSession(
|
||||||
|
system.createSessionBuilder(), MavenRepositorySystemUtils.newArtifactTypeRegistry());
|
||||||
LocalRepository localRepo = new LocalRepository("target/local-repo");
|
|
||||||
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
|
|
||||||
|
|
||||||
|
session.withLocalRepositories(new LocalRepository("target/local-repo"));
|
||||||
session.setTransferListener(new ConsoleTransferListener());
|
session.setTransferListener(new ConsoleTransferListener());
|
||||||
session.setRepositoryListener(new ConsoleRepositoryListener());
|
session.setRepositoryListener(new ConsoleRepositoryListener());
|
||||||
|
|
||||||
return session;
|
return session.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RemoteRepository newTestRepository() throws MalformedURLException {
|
public static RemoteRepository newTestRepository() throws MalformedURLException {
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
package org.apache.maven.repository.internal;
|
|
||||||
|
|
||||||
import org.eclipse.aether.RepositorySystemSession;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
||||||
|
|
||||||
class MavenRepositorySystemUtilsTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testNewSession() {
|
|
||||||
RepositorySystemSession session = MavenRepositorySystemUtils.newSession();
|
|
||||||
assertNotNull(session);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue