Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,42 @@
@Deprecated
public class MavenCli {

/**
* @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_REPO_LOCAL} instead
*/
public static final String LOCAL_REPO_PROPERTY = "maven.repo.local";

/**
* @deprecated Use {@link org.apache.maven.api.Session#getRootDirectory()} instead
*/
public static final String MULTIMODULE_PROJECT_DIRECTORY = "maven.multiModuleProjectDirectory";

/**
* @deprecated Use {@link System#getProperty(String)} with "user.home" instead
*/
public static final String USER_HOME = System.getProperty("user.home");

/**
* @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_USER_CONF} instead
*/
public static final File USER_MAVEN_CONFIGURATION_HOME = new File(USER_HOME, ".m2");

/**
* @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_USER_TOOLCHAINS} instead
*/
public static final File DEFAULT_USER_TOOLCHAINS_FILE = new File(USER_MAVEN_CONFIGURATION_HOME, "toolchains.xml");

/**
* @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_INSTALLATION_TOOLCHAINS} instead
*/
public static final File DEFAULT_GLOBAL_TOOLCHAINS_FILE =
new File(System.getProperty("maven.conf"), "toolchains.xml");

/**
* @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_STYLE_COLOR_PROPERTY} instead
*/
public static final String STYLE_COLOR_PROPERTY = "style.color";

private static final String MVN_MAVEN_CONFIG = ".mvn/maven.config";

private ClassWorld classWorld;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.maven.cli.internal;

import org.apache.maven.api.cli.extensions.CoreExtension;
import org.apache.maven.cli.internal.extension.model.CoreExtension;

/**
* Exception occurring trying to resolve a plugin.
Expand All @@ -37,6 +37,28 @@ public ExtensionResolutionException(CoreExtension extension, Throwable cause) {
this.extension = extension;
}

/**
* Constructor accepting the new API type for internal use.
*
* @param extension the new API extension
* @param cause the cause
*/
public ExtensionResolutionException(org.apache.maven.api.cli.extensions.CoreExtension extension, Throwable cause) {
super(
"Extension " + extension.getId() + " or one of its dependencies could not be resolved: "
+ cause.getMessage(),
cause);
// Convert to old type
CoreExtension oldExtension = new CoreExtension();
oldExtension.setGroupId(extension.getGroupId());
oldExtension.setArtifactId(extension.getArtifactId());
oldExtension.setVersion(extension.getVersion());
if (extension.getClassLoadingStrategy() != null) {
oldExtension.setClassLoadingStrategy(extension.getClassLoadingStrategy());
}
this.extension = oldExtension;
}

public CoreExtension getExtension() {
return extension;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/*
* 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.cli.internal.extension.model;

/**
* Describes a build extension to utilise.
*
* @deprecated Use {@link org.apache.maven.api.cli.extensions.CoreExtension} instead
*/
@Deprecated
@SuppressWarnings("all")
public class CoreExtension implements java.io.Serializable {

// --------------------------/
// - Class/Member Variables -/
// --------------------------/

/**
* The group ID of the extension's artifact.
*/
private String groupId;

/**
* The artifact ID of the extension.
*/
private String artifactId;

/**
* The version of the extension.
*/
private String version;

/**
* The class loading strategy: 'self-first' (the default),
* 'parent-first' (loads classes from the parent, then from the
* extension) or 'plugin' (follows the rules from extensions
* defined as plugins).
*/
private String classLoadingStrategy = "self-first";

// -----------/
// - Methods -/
// -----------/

/**
* Get the artifact ID of the extension.
*
* @return String
*/
public String getArtifactId() {
return this.artifactId;
} // -- String getArtifactId()

/**
* Get the class loading strategy: 'self-first' (the default),
* 'parent-first' (loads classes from the parent, then from the
* extension) or 'plugin' (follows the rules from extensions
* defined as plugins).
*
* @return String
*/
public String getClassLoadingStrategy() {
return this.classLoadingStrategy;
} // -- String getClassLoadingStrategy()

/**
* Get the group ID of the extension's artifact.
*
* @return String
*/
public String getGroupId() {
return this.groupId;
} // -- String getGroupId()

/**
* Get the version of the extension.
*
* @return String
*/
public String getVersion() {
return this.version;
} // -- String getVersion()

/**
* Set the artifact ID of the extension.
*
* @param artifactId a artifactId object.
*/
public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
} // -- void setArtifactId( String )

/**
* Set the class loading strategy: 'self-first' (the default),
* 'parent-first' (loads classes from the parent, then from the
* extension) or 'plugin' (follows the rules from extensions
* defined as plugins).
*
* @param classLoadingStrategy a classLoadingStrategy object.
*/
public void setClassLoadingStrategy(String classLoadingStrategy) {
this.classLoadingStrategy = classLoadingStrategy;
} // -- void setClassLoadingStrategy( String )

/**
* Set the group ID of the extension's artifact.
*
* @param groupId a groupId object.
*/
public void setGroupId(String groupId) {
this.groupId = groupId;
} // -- void setGroupId( String )

/**
* Set the version of the extension.
*
* @param version a version object.
*/
public void setVersion(String version) {
this.version = version;
} // -- void setVersion( String )

/**
* Gets the identifier of the extension.
*
* @return The extension id in the form {@code <groupId>:<artifactId>:<version>}, never {@code null}.
*/
public String getId() {
StringBuilder id = new StringBuilder(128);

id.append((getGroupId() == null) ? "[unknown-group-id]" : getGroupId());
id.append(":");
id.append((getArtifactId() == null) ? "[unknown-artifact-id]" : getArtifactId());
id.append(":");
id.append((getVersion() == null) ? "[unknown-version]" : getVersion());

return id.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
* 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.cli.internal.extension.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
* Extensions to load.
*
* @deprecated Use {@link org.apache.maven.api.cli.extensions.CoreExtension} instead
*/
@Deprecated
@SuppressWarnings("all")
public class CoreExtensions implements Serializable {

// --------------------------/
// - Class/Member Variables -/
// --------------------------/

/**
* Field extensions.
*/
private List<CoreExtension> extensions;

/**
* Field modelEncoding.
*/
private String modelEncoding = "UTF-8";

// -----------/
// - Methods -/
// -----------/

/**
* Method addExtension.
*
* @param coreExtension a coreExtension object.
*/
public void addExtension(CoreExtension coreExtension) {
getExtensions().add(coreExtension);
} // -- void addExtension( CoreExtension )

/**
* Method getExtensions.
*
* @return List
*/
public List<CoreExtension> getExtensions() {
if (this.extensions == null) {
this.extensions = new ArrayList<CoreExtension>();
}

return this.extensions;
} // -- List<CoreExtension> getExtensions()

/**
* Get the modelEncoding field.
*
* @return String
*/
public String getModelEncoding() {
return this.modelEncoding;
} // -- String getModelEncoding()

/**
* Method removeExtension.
*
* @param coreExtension a coreExtension object.
*/
public void removeExtension(CoreExtension coreExtension) {
getExtensions().remove(coreExtension);
} // -- void removeExtension( CoreExtension )

/**
* Set a set of build extensions to use from this project.
*
* @param extensions a extensions object.
*/
public void setExtensions(List<CoreExtension> extensions) {
this.extensions = extensions;
} // -- void setExtensions( List )

/**
* Set the modelEncoding field.
*
* @param modelEncoding a modelEncoding object.
*/
public void setModelEncoding(String modelEncoding) {
this.modelEncoding = modelEncoding;
} // -- void setModelEncoding( String )
}
Loading