From 753a6c60f47f3ac4f270005b65e9d6481de8eb68 Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Fri, 23 Oct 2015 10:00:02 -0700 Subject: Adding maven and ant source trees Change-Id: I0a39b9add833a31b9c3f98d193983ae2f3a5a445 Signed-off-by: Ashlee Young --- .../apache-maven-3.3.3/maven-plugin-api/pom.xml | 91 +++ .../apache/maven/monitor/logging/DefaultLog.java | 131 ++++ .../java/org/apache/maven/plugin/AbstractMojo.java | 198 ++++++ .../plugin/AbstractMojoExecutionException.java | 53 ++ .../org/apache/maven/plugin/ContextEnabled.java | 45 ++ .../main/java/org/apache/maven/plugin/Mojo.java | 72 +++ .../maven/plugin/MojoExecutionException.java | 80 +++ .../apache/maven/plugin/MojoFailureException.java | 69 ++ .../apache/maven/plugin/MojoNotFoundException.java | 85 +++ .../DuplicateMojoDescriptorException.java | 34 + .../descriptor/DuplicateParameterException.java | 31 + .../descriptor/InvalidParameterException.java | 37 ++ .../InvalidPluginDescriptorException.java | 38 ++ .../maven/plugin/descriptor/MojoDescriptor.java | 719 +++++++++++++++++++++ .../apache/maven/plugin/descriptor/Parameter.java | 207 ++++++ .../maven/plugin/descriptor/PluginDescriptor.java | 445 +++++++++++++ .../plugin/descriptor/PluginDescriptorBuilder.java | 358 ++++++++++ .../maven/plugin/descriptor/Requirement.java | 72 +++ .../java/org/apache/maven/plugin/logging/Log.java | 158 +++++ .../maven/plugin/logging/SystemStreamLog.java | 196 ++++++ .../maven-plugin-api/src/main/mdo/lifecycle.mdo | 129 ++++ .../maven-plugin-api/src/main/mdo/plugin.mdo | 525 +++++++++++++++ .../maven-plugin-api/src/site/apt/index.apt | 39 ++ .../maven-plugin-api/src/site/site.xml | 40 ++ .../descriptor/PluginDescriptorBuilderTest.java | 133 ++++ .../plugin/lifecycle/LifecycleXpp3ReaderTest.java | 55 ++ .../src/test/resources/lifecycle.xml | 39 ++ .../maven-plugin-api/src/test/resources/plugin.xml | 89 +++ 28 files changed, 4168 insertions(+) create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/monitor/logging/DefaultLog.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/ContextEnabled.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/Mojo.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoNotFoundException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateParameterException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/InvalidParameterException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/InvalidPluginDescriptorException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/Requirement.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/Log.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/SystemStreamLog.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/mdo/lifecycle.mdo create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/mdo/plugin.mdo create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/site/apt/index.apt create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/site/site.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilderTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/resources/lifecycle.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/resources/plugin.xml (limited to 'framework/src/maven/apache-maven-3.3.3/maven-plugin-api') diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/pom.xml new file mode 100644 index 00000000..40e7c0f9 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/pom.xml @@ -0,0 +1,91 @@ + + + + + + 4.0.0 + + + org.apache.maven + maven + 3.3.3 + + + maven-plugin-api + + Maven Plugin API + The API for plugins - Mojos - development. + + + scm:git:https://git-wip-us.apache.org/repos/asf/maven.git + scm:git:https://git-wip-us.apache.org/repos/asf/maven.git + maven-3.3.3 + + + + + org.apache.maven + maven-model + + + org.apache.maven + maven-artifact + + + wagon-provider-api + org.apache.maven.wagon + + + + + org.eclipse.sisu + org.eclipse.sisu.plexus + + + + + + + org.codehaus.modello + modello-maven-plugin + + + src/main/mdo/lifecycle.mdo + + 1.0.0 + + + + plugin-site-doc + pre-site + + xdoc + + + + src/main/mdo/plugin.mdo + + + + + + + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/monitor/logging/DefaultLog.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/monitor/logging/DefaultLog.java new file mode 100644 index 00000000..4fee2e25 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/monitor/logging/DefaultLog.java @@ -0,0 +1,131 @@ +package org.apache.maven.monitor.logging; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.plugin.logging.Log; +import org.codehaus.plexus.logging.Logger; + +/** + * @author jdcasey + */ +public class DefaultLog + implements Log +{ + + private final Logger logger; + + public DefaultLog( Logger logger ) + { + this.logger = logger; + } + + public void debug( CharSequence content ) + { + logger.debug( toString( content ) ); + } + + private String toString( CharSequence content ) + { + if ( content == null ) + { + return ""; + } + else + { + return content.toString(); + } + } + + public void debug( CharSequence content, Throwable error ) + { + logger.debug( toString( content ), error ); + } + + public void debug( Throwable error ) + { + logger.debug( "", error ); + } + + public void info( CharSequence content ) + { + logger.info( toString( content ) ); + } + + public void info( CharSequence content, Throwable error ) + { + logger.info( toString( content ), error ); + } + + public void info( Throwable error ) + { + logger.info( "", error ); + } + + public void warn( CharSequence content ) + { + logger.warn( toString( content ) ); + } + + public void warn( CharSequence content, Throwable error ) + { + logger.warn( toString( content ), error ); + } + + public void warn( Throwable error ) + { + logger.warn( "", error ); + } + + public void error( CharSequence content ) + { + logger.error( toString( content ) ); + } + + public void error( CharSequence content, Throwable error ) + { + logger.error( toString( content ), error ); + } + + public void error( Throwable error ) + { + logger.error( "", error ); + } + + public boolean isDebugEnabled() + { + return logger.isDebugEnabled(); + } + + public boolean isInfoEnabled() + { + return logger.isInfoEnabled(); + } + + public boolean isWarnEnabled() + { + return logger.isWarnEnabled(); + } + + public boolean isErrorEnabled() + { + return logger.isErrorEnabled(); + } + +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java new file mode 100644 index 00000000..d33e9bfc --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java @@ -0,0 +1,198 @@ +package org.apache.maven.plugin; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Map; + +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.plugin.logging.SystemStreamLog; + +/** + * Abstract class to provide most of the infrastructure required to implement a Mojo except for + * the execute method. + *
+ * The implementation should have a goal annotation in the class-level javadoc annotation: + *
+ * /**
+ *  * @goal goalName
+ *  */
+ * 
+ * + * There are also a number of class-level javadoc annotations which can be used to control how and when the + * Mojo is executed: + *
+ *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Descriptor ElementAnnotationRequired?Notes
goal@goal <goalName>YesThe name for the Mojo that users will reference from the command line to execute the Mojo directly, + * or inside a POM in order to provide Mojo-specific configuration.
implementationnone (detected)YesThe Mojo's fully-qualified class name (or script path in the case of non-Java Mojos).
languagenone (detected)No. Default: javaThe implementation language for this Mojo (Java, beanshell, etc.).
configurator@configurator <roleHint>NoThe configurator type to use when injecting parameter values into this Mojo. The value is normally + * deduced from the Mojo's implementation language, but can be specified to allow a custom + * ComponentConfigurator implementation to be used. + *
+ * NOTE: This will only be used in very special cases, using a highly controlled vocabulary of possible + * values. (Elements like this are why it's a good idea to use the descriptor tools.) + *
phase@phase <phaseName>NoBinds this Mojo to a particular phase of the standard build lifecycle, if specified. + *
+ * NOTE: This is only required if this Mojo is to participate in the standard build process. + *
execute@execute [phase=<phaseName>|goal=<goalName>] [lifecycle=<lifecycleId>]NoWhen this goal is invoked, it will first invoke a parallel lifecycle, ending at the given phase. + * If a goal is provided instead of a phase, that goal will be executed in isolation. + * The execution of either will not affect the current project, but instead make available the + * ${executedProject} expression if required. An alternate lifecycle can also be provided: + * for more information see the documentation on the + * build lifecycle. + *
requiresDependencyResolution@requiresDependencyResolution <requiredScope>NoFlags this Mojo as requiring the dependencies in the specified scope (or an implied scope) to be + * resolved before it can execute. + *
+ * NOTE: Currently supports compile, runtime, and test scopes. + *
descriptionnone (detected)NoThe description of this Mojo's functionality. Using the toolset, this will be the class-level + * Javadoc description provided. + *
+ * NOTE: While this is not a required part of the Mojo specification, it SHOULD be provided to + * enable future tool support for browsing, etc. and for clarity. + *
parametersN/ANoSpecifications for the parameters which this Mojo uses will be provided in parameter sub-elements + * in this section. + *
+ * NOTE: Parameters are discussed in more detail below. + *
+ * + * @see Guide to Developing Java Plugins + * @see Guide to Configuring Plug-ins + * @see Mojo API Specification + * + * @author Brett Porter + * @author jdcasey + * @author Vincent Siveton + */ +public abstract class AbstractMojo + implements Mojo, ContextEnabled +{ + /** Instance logger */ + private Log log; + + /** Plugin container context */ + private Map pluginContext; + + /** + * @see org.apache.maven.plugin.Mojo#setLog(org.apache.maven.plugin.logging.Log) + */ + public void setLog( Log log ) + { + this.log = log; + } + + /** + * Returns the logger that has been injected into this mojo. If no logger has been setup yet, a + * SystemStreamLog logger will be created and returned. + *

+ * Note: + * The logger returned by this method must not be cached in an instance field during the construction of the mojo. + * This would cause the mojo to use a wrongly configured default logger when being run by Maven. The proper logger + * gets injected by the Plexus container after the mojo has been constructed. Therefore, simply call this + * method directly whenever you need the logger, it is fast enough and needs no caching. + * + * @see org.apache.maven.plugin.Mojo#getLog() + */ + public Log getLog() + { + if ( log == null ) + { + log = new SystemStreamLog(); + } + + return log; + } + + /** + * @see org.apache.maven.plugin.ContextEnabled#getPluginContext() + */ + public Map getPluginContext() + { + return pluginContext; + } + + /** + * @see org.apache.maven.plugin.ContextEnabled#setPluginContext(java.util.Map) + */ + public void setPluginContext( Map pluginContext ) + { + this.pluginContext = pluginContext; + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java new file mode 100644 index 00000000..52aded3d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojoExecutionException.java @@ -0,0 +1,53 @@ +package org.apache.maven.plugin; + +/* + * 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. + */ + +/** + * Base exception. + * + * @author Brett Porter + */ +public abstract class AbstractMojoExecutionException + extends Exception +{ + protected Object source; + + protected String longMessage; + + public AbstractMojoExecutionException( String message ) + { + super( message ); + } + + public AbstractMojoExecutionException( String message, Throwable cause ) + { + super( message, cause ); + } + + public String getLongMessage() + { + return longMessage; + } + + public Object getSource() + { + return source; + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/ContextEnabled.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/ContextEnabled.java new file mode 100644 index 00000000..d63cb49b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/ContextEnabled.java @@ -0,0 +1,45 @@ +package org.apache.maven.plugin; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Map; + +/** + * Interface to allow Mojos to communicate with each others Mojos, other than + * project's source root and project's attachment. + *
+ * The plugin manager would pull the context out of the plugin container context, and populate it into the Mojo. + * + * @author jdcasey + */ +public interface ContextEnabled +{ + /** + * Set a new shared context Map to a mojo before executing it. + * + * @param pluginContext a new Map + */ + void setPluginContext( Map pluginContext ); + + /** + * @return a Map stored in the plugin container's context. + */ + Map getPluginContext(); +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/Mojo.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/Mojo.java new file mode 100644 index 00000000..76a2aad7 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/Mojo.java @@ -0,0 +1,72 @@ +package org.apache.maven.plugin; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.plugin.logging.Log; + +/** + * This interface forms the contract required for Mojos to interact with the Maven + * infrastructure. + *
+ * It features an execute() method, which triggers the Mojo's build-process behavior, and can throw + * a MojoExecutionException or MojoFailureException if error conditions occur. + *
+ * Also included is the setLog(...) method, which simply allows Maven to inject a logging mechanism which + * will allow the Mojo to communicate to the outside world through standard Maven channels. + * + * @author Jason van Zyl + */ +public interface Mojo +{ + /** The component role hint for Plexus container */ + String ROLE = Mojo.class.getName(); + + /** + * Perform whatever build-process behavior this Mojo implements. + *
+ * This is the main trigger for the Mojo inside the Maven system, and allows + * the Mojo to communicate errors. + * + * @throws MojoExecutionException if an unexpected problem occurs. + * Throwing this exception causes a "BUILD ERROR" message to be displayed. + * @throws MojoFailureException if an expected problem (such as a compilation failure) occurs. + * Throwing this exception causes a "BUILD FAILURE" message to be displayed. + */ + void execute() + throws MojoExecutionException, MojoFailureException; + + /** + * Inject a standard Maven logging mechanism to allow this Mojo to communicate events + * and feedback to the user. + * + * @param log a new logger + */ + // TODO: not sure about this here, and may want a getLog on here as well/instead + void setLog( Log log ); + + /** + * Furnish access to the standard Maven logging mechanism which is managed in this base class. + * + * @return a log4j-like logger object which allows plugins to create messages at levels of "debug", + * "info", "warn", and "error". This logger is the accepted means to display + * information to the user. + */ + Log getLog(); +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java new file mode 100644 index 00000000..b440af02 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoExecutionException.java @@ -0,0 +1,80 @@ +package org.apache.maven.plugin; + +/* + * 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. + */ + +/** + * An exception occurring during the execution of a plugin. + *
+ * Throwing this exception causes a "BUILD ERROR" message to be displayed. + * + * @author Brett Porter + */ +public class MojoExecutionException + extends AbstractMojoExecutionException +{ + /** + * Construct a new MojoExecutionException exception providing the source and a short and long message: + * these messages are used to improve the message written at the end of Maven build. + * + * @param source + * @param shortMessage + * @param longMessage + */ + public MojoExecutionException( Object source, String shortMessage, String longMessage ) + { + super( shortMessage ); + this.source = source; + this.longMessage = longMessage; + } + + /** + * Construct a new MojoExecutionException exception wrapping an underlying Exception + * and providing a message. + * + * @param message + * @param cause + */ + public MojoExecutionException( String message, Exception cause ) + { + super( message, cause ); + } + + /** + * Construct a new MojoExecutionException exception wrapping an underlying Throwable + * and providing a message. + * + * @param message + * @param cause + */ + public MojoExecutionException( String message, Throwable cause ) + { + super( message, cause ); + } + + /** + * Construct a new MojoExecutionException exception providing a message. + * + * @param message + */ + public MojoExecutionException( String message ) + { + super( message ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java new file mode 100644 index 00000000..28dc43d3 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoFailureException.java @@ -0,0 +1,69 @@ +package org.apache.maven.plugin; + +/* + * 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. + */ + +/** + * An exception occurring during the execution of a plugin (such as a compilation failure). + *
+ * Throwing this exception causes a "BUILD FAILURE" message to be displayed. + * + * @author Brett Porter + */ +public class MojoFailureException + extends AbstractMojoExecutionException +{ + /** + * Construct a new MojoFailureException exception providing the source and a short and long message: + * these messages are used to improve the message written at the end of Maven build. + * + * @param source + * @param shortMessage + * @param longMessage + */ + public MojoFailureException( Object source, String shortMessage, String longMessage ) + { + super( shortMessage ); + this.source = source; + this.longMessage = longMessage; + } + + /** + * Construct a new MojoFailureException exception providing a message. + * + * @param message + */ + public MojoFailureException( String message ) + { + super( message ); + } + + /** + * Construct a new MojoFailureException exception wrapping an underlying Throwable + * and providing a message. + * + * @param message + * @param cause + * @since 2.0.9 + */ + public MojoFailureException( String message, Throwable cause ) + { + super( message, cause ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoNotFoundException.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoNotFoundException.java new file mode 100644 index 00000000..4d99546a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/MojoNotFoundException.java @@ -0,0 +1,85 @@ +package org.apache.maven.plugin; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Iterator; +import java.util.List; + +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptor; + +public class MojoNotFoundException + extends Exception +{ + private String goal; + + private PluginDescriptor pluginDescriptor; + + public MojoNotFoundException( String goal, PluginDescriptor pluginDescriptor ) + { + super( toMessage( goal, pluginDescriptor ) ); + + this.goal = goal; + this.pluginDescriptor = pluginDescriptor; + } + + public String getGoal() + { + return goal; + } + + public PluginDescriptor getPluginDescriptor() + { + return pluginDescriptor; + } + + private static String toMessage( String goal, PluginDescriptor pluginDescriptor ) + { + StringBuilder buffer = new StringBuilder( 256 ); + + buffer.append( "Could not find goal '" ).append( goal ).append( "'" ); + + if ( pluginDescriptor != null ) + { + buffer.append( " in plugin " ).append( pluginDescriptor.getId() ); + + buffer.append( " among available goals " ); + List mojos = pluginDescriptor.getMojos(); + if ( mojos != null ) + { + for ( Iterator it = mojos.iterator(); it.hasNext(); ) + { + MojoDescriptor mojo = it.next(); + if ( mojo != null ) + { + buffer.append( mojo.getGoal() ); + } + if ( it.hasNext() ) + { + buffer.append( ", " ); + } + } + } + } + + return buffer.toString(); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java new file mode 100644 index 00000000..b236c8c7 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java @@ -0,0 +1,34 @@ +package org.apache.maven.plugin.descriptor; + +/* + * 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. + */ + +public class DuplicateMojoDescriptorException + extends InvalidPluginDescriptorException +{ + + public DuplicateMojoDescriptorException( String goalPrefix, String goal, String existingImplementation, + String newImplementation ) + { + super( "Goal: " + goal + " already exists in the plugin descriptor for prefix: " + goalPrefix + + "\nExisting implementation is: " + existingImplementation + + "\nConflicting implementation is: " + newImplementation ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateParameterException.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateParameterException.java new file mode 100644 index 00000000..4cad9b7c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateParameterException.java @@ -0,0 +1,31 @@ +package org.apache.maven.plugin.descriptor; + +/* + * 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. + */ + +public class DuplicateParameterException + extends InvalidPluginDescriptorException +{ + + public DuplicateParameterException( String message ) + { + super( message ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/InvalidParameterException.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/InvalidParameterException.java new file mode 100644 index 00000000..557a3d54 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/InvalidParameterException.java @@ -0,0 +1,37 @@ +package org.apache.maven.plugin.descriptor; + +/* + * 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. + */ + +/** + * @author Jason van Zyl + */ +public class InvalidParameterException + extends InvalidPluginDescriptorException +{ + public InvalidParameterException( String element, int i ) + { + super( "The " + element + " element in parameter # " + i + " is invalid. It cannot be null." ); + } + + public InvalidParameterException( String message, Throwable cause ) + { + super( message, cause ); + } +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/InvalidPluginDescriptorException.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/InvalidPluginDescriptorException.java new file mode 100644 index 00000000..4b8e7397 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/InvalidPluginDescriptorException.java @@ -0,0 +1,38 @@ +package org.apache.maven.plugin.descriptor; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.codehaus.plexus.configuration.PlexusConfigurationException; + +public class InvalidPluginDescriptorException + extends PlexusConfigurationException +{ + + public InvalidPluginDescriptorException( String message, Throwable cause ) + { + super( message, cause ); + } + + public InvalidPluginDescriptorException( String message ) + { + super( message ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java new file mode 100644 index 00000000..bc2d5554 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java @@ -0,0 +1,719 @@ +package org.apache.maven.plugin.descriptor; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.apache.maven.plugin.Mojo; +import org.codehaus.plexus.component.repository.ComponentDescriptor; +import org.codehaus.plexus.configuration.PlexusConfiguration; +import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; + +/** + * The bean containing the Mojo descriptor. + *
+ * For more information about the usage tag, have a look to: + * + * http://maven.apache.org/developers/mojo-api-specification.html + * + * @todo is there a need for the delegation of MavenMojoDescriptor to this? + * Why not just extend ComponentDescriptor here? + */ +public class MojoDescriptor + extends ComponentDescriptor + implements Cloneable +{ + /** The Plexus component type */ + public static final String MAVEN_PLUGIN = "maven-plugin"; + + /** "once-per-session" execution strategy */ + public static final String SINGLE_PASS_EXEC_STRATEGY = "once-per-session"; + + /** "always" execution strategy */ + public static final String MULTI_PASS_EXEC_STRATEGY = "always"; + + private static final String DEFAULT_INSTANTIATION_STRATEGY = "per-lookup"; + + private static final String DEFAULT_LANGUAGE = "java"; + + private List parameters; + + private Map parameterMap; + + /** By default, the execution strategy is "once-per-session" */ + private String executionStrategy = SINGLE_PASS_EXEC_STRATEGY; + + /** + * The goal name for the Mojo, that users will reference from the command line to execute the Mojo directly, or + * inside a POM in order to provide Mojo-specific configuration. + */ + private String goal; + + /** + * Defines a default phase to bind a mojo execution to if the user does not explicitly set a phase in the POM. + * Note: This will not automagically make a mojo run when the plugin declaration is added to the POM. It + * merely enables the user to omit the <phase> element from the surrounding + * <execution> element. + */ + private String phase; + + /** Specify the version when the Mojo was added to the API. Similar to Javadoc since. */ + private String since; + + /** Reference the invocation phase of the Mojo. */ + private String executePhase; + + /** Reference the invocation goal of the Mojo. */ + private String executeGoal; + + /** Reference the invocation lifecycle of the Mojo. */ + private String executeLifecycle; + + /** + * Specify the version when the Mojo was deprecated to the API. Similar to Javadoc deprecated. This will trigger a + * warning when a user tries to configure a parameter marked as deprecated. + */ + private String deprecated; + + /** + * Flags this Mojo to run it in a multi module way, i.e. aggregate the build with the set of projects listed as + * modules. By default, no need to aggregate the Maven project and its child modules + */ + private boolean aggregator = false; + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + + /** Specify the required dependencies in a specified scope */ + private String dependencyResolutionRequired = null; + + /** + * The scope of (transitive) dependencies that should be collected but not resolved. + * @since 3.0-alpha-3 + */ + private String dependencyCollectionRequired; + + /** By default, the Mojo needs a Maven project to be executed */ + private boolean projectRequired = true; + + /** By default, the Mojo is assumed to work offline as well */ + private boolean onlineRequired = false; + + /** Plugin configuration */ + private PlexusConfiguration mojoConfiguration; + + /** Plugin descriptor */ + private PluginDescriptor pluginDescriptor; + + /** By default, the Mojo is inherited */ + private boolean inheritedByDefault = true; + + /** By default, the Mojo cannot be invoked directly */ + private boolean directInvocationOnly = false; + + /** By default, the Mojo don't need reports to run */ + private boolean requiresReports = false; + + /** + * By default, mojos are not threadsafe + * @since 3.0-beta-2 + */ + private boolean threadSafe = false; + + /** + * Default constructor. + */ + public MojoDescriptor() + { + setInstantiationStrategy( DEFAULT_INSTANTIATION_STRATEGY ); + setComponentFactory( DEFAULT_LANGUAGE ); + } + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + + /** + * @return the language of this Mojo, i.e. java + */ + public String getLanguage() + { + return getComponentFactory(); + } + + /** + * @param language the new language + */ + public void setLanguage( String language ) + { + setComponentFactory( language ); + } + + /** + * @return true if the Mojo is deprecated, false otherwise. + */ + public String getDeprecated() + { + return deprecated; + } + + /** + * @param deprecated true to deprecate the Mojo, false otherwise. + */ + public void setDeprecated( String deprecated ) + { + this.deprecated = deprecated; + } + + /** + * @return the list of parameters + */ + public List getParameters() + { + return parameters; + } + + /** + * @param parameters the new list of parameters + * @throws DuplicateParameterException if any + */ + public void setParameters( List parameters ) + throws DuplicateParameterException + { + for ( Parameter parameter : parameters ) + { + addParameter( parameter ); + } + } + + /** + * @param parameter add a new parameter + * @throws DuplicateParameterException if any + */ + public void addParameter( Parameter parameter ) + throws DuplicateParameterException + { + if ( parameters != null && parameters.contains( parameter ) ) + { + throw new DuplicateParameterException( parameter.getName() + + " has been declared multiple times in mojo with goal: " + getGoal() + " (implementation: " + + getImplementation() + ")" ); + } + + if ( parameters == null ) + { + parameters = new LinkedList(); + } + + parameters.add( parameter ); + } + + /** + * @return the list parameters as a Map + */ + public Map getParameterMap() + { + if ( parameterMap == null ) + { + parameterMap = new HashMap(); + + if ( parameters != null ) + { + for ( Parameter pd : parameters ) + { + parameterMap.put( pd.getName(), pd ); + } + } + } + + return parameterMap; + } + + // ---------------------------------------------------------------------- + // Dependency requirement + // ---------------------------------------------------------------------- + + /** + * @param requiresDependencyResolution the new required dependencies in a specified scope + */ + public void setDependencyResolutionRequired( String requiresDependencyResolution ) + { + this.dependencyResolutionRequired = requiresDependencyResolution; + } + + public String getDependencyResolutionRequired() + { + return dependencyResolutionRequired; + } + + /** + * @return the required dependencies in a specified scope + * @TODO the name is not intelligible + */ + @Deprecated + public String isDependencyResolutionRequired() + { + return dependencyResolutionRequired; + } + + /** + * @since 3.0-alpha-3 + */ + public void setDependencyCollectionRequired( String requiresDependencyCollection ) + { + this.dependencyCollectionRequired = requiresDependencyCollection; + } + + /** + * Gets the scope of (transitive) dependencies that should be collected. Dependency collection refers to the process + * of calculating the complete dependency tree in terms of artifact coordinates. In contrast to dependency + * resolution, this does not include the download of the files for the dependency artifacts. It is meant for mojos + * that only want to analyze the set of transitive dependencies, in particular during early lifecycle phases where + * full dependency resolution might fail due to projects which haven't been built yet. + * + * @return The scope of (transitive) dependencies that should be collected or {@code null} if none. + * @since 3.0-alpha-3 + */ + public String getDependencyCollectionRequired() + { + return dependencyCollectionRequired; + } + + // ---------------------------------------------------------------------- + // Project requirement + // ---------------------------------------------------------------------- + + /** + * @param requiresProject true if the Mojo needs a Maven project to be executed, false + * otherwise. + */ + public void setProjectRequired( boolean requiresProject ) + { + this.projectRequired = requiresProject; + } + + /** + * @return true if the Mojo needs a Maven project to be executed, false otherwise. + */ + public boolean isProjectRequired() + { + return projectRequired; + } + + // ---------------------------------------------------------------------- + // Online vs. Offline requirement + // ---------------------------------------------------------------------- + + /** + * @param requiresOnline true if the Mojo is online, false otherwise. + */ + public void setOnlineRequired( boolean requiresOnline ) + { + this.onlineRequired = requiresOnline; + } + + /** + * @return true if the Mojo is online, false otherwise. + */ + // blech! this isn't even intelligible as a method name. provided for + // consistency... + public boolean isOnlineRequired() + { + return onlineRequired; + } + + /** + * @return true if the Mojo is online, false otherwise. + */ + // more english-friendly method...keep the code clean! :) + public boolean requiresOnline() + { + return onlineRequired; + } + + /** + * @return the binded phase name of the Mojo + */ + public String getPhase() + { + return phase; + } + + /** + * @param phase the new binded phase name of the Mojo + */ + public void setPhase( String phase ) + { + this.phase = phase; + } + + /** + * @return the version when the Mojo was added to the API + */ + public String getSince() + { + return since; + } + + /** + * @param since the new version when the Mojo was added to the API + */ + public void setSince( String since ) + { + this.since = since; + } + + /** + * @return The goal name of the Mojo + */ + public String getGoal() + { + return goal; + } + + /** + * @param goal The new goal name of the Mojo + */ + public void setGoal( String goal ) + { + this.goal = goal; + } + + /** + * @return the invocation phase of the Mojo + */ + public String getExecutePhase() + { + return executePhase; + } + + /** + * @param executePhase the new invocation phase of the Mojo + */ + public void setExecutePhase( String executePhase ) + { + this.executePhase = executePhase; + } + + /** + * @return true if the Mojo uses always for the executionStrategy + */ + public boolean alwaysExecute() + { + return MULTI_PASS_EXEC_STRATEGY.equals( executionStrategy ); + } + + /** + * @return the execution strategy + */ + public String getExecutionStrategy() + { + return executionStrategy; + } + + /** + * @param executionStrategy the new execution strategy + */ + public void setExecutionStrategy( String executionStrategy ) + { + this.executionStrategy = executionStrategy; + } + + /** + * @return the mojo configuration + */ + public PlexusConfiguration getMojoConfiguration() + { + if ( mojoConfiguration == null ) + { + mojoConfiguration = new XmlPlexusConfiguration( "configuration" ); + } + return mojoConfiguration; + } + + /** + * @param mojoConfiguration a new mojo configuration + */ + public void setMojoConfiguration( PlexusConfiguration mojoConfiguration ) + { + this.mojoConfiguration = mojoConfiguration; + } + + /** {@inheritDoc} */ + public String getRole() + { + return Mojo.ROLE; + } + + /** {@inheritDoc} */ + public String getRoleHint() + { + return getId(); + } + + /** + * @return the id of the mojo, based on the goal name + */ + public String getId() + { + return getPluginDescriptor().getId() + ":" + getGoal(); + } + + /** + * @return the full goal name + * @see PluginDescriptor#getGoalPrefix() + * @see #getGoal() + */ + public String getFullGoalName() + { + return getPluginDescriptor().getGoalPrefix() + ":" + getGoal(); + } + + /** {@inheritDoc} */ + public String getComponentType() + { + return MAVEN_PLUGIN; + } + + /** + * @return the plugin descriptor + */ + public PluginDescriptor getPluginDescriptor() + { + return pluginDescriptor; + } + + /** + * @param pluginDescriptor the new plugin descriptor + */ + public void setPluginDescriptor( PluginDescriptor pluginDescriptor ) + { + this.pluginDescriptor = pluginDescriptor; + } + + /** + * @return true if the Mojo is herited, false otherwise. + */ + public boolean isInheritedByDefault() + { + return inheritedByDefault; + } + + /** + * @param inheritedByDefault true if the Mojo is herited, false otherwise. + */ + public void setInheritedByDefault( boolean inheritedByDefault ) + { + this.inheritedByDefault = inheritedByDefault; + } + + /** {@inheritDoc} */ + public boolean equals( Object object ) + { + if ( this == object ) + { + return true; + } + + if ( object instanceof MojoDescriptor ) + { + MojoDescriptor other = (MojoDescriptor) object; + + if ( !compareObjects( getPluginDescriptor(), other.getPluginDescriptor() ) ) + { + return false; + } + + return compareObjects( getGoal(), other.getGoal() ); + + } + + return false; + } + + private boolean compareObjects( Object first, Object second ) + { + if ( first == second ) + { + return true; + } + + if ( first == null || second == null ) + { + return false; + } + + return first.equals( second ); + } + + /** {@inheritDoc} */ + public int hashCode() + { + int result = 1; + + String goal = getGoal(); + + if ( goal != null ) + { + result += goal.hashCode(); + } + + PluginDescriptor pd = getPluginDescriptor(); + + if ( pd != null ) + { + result -= pd.hashCode(); + } + + return result; + } + + /** + * @return the invocation lifecycle of the Mojo + */ + public String getExecuteLifecycle() + { + return executeLifecycle; + } + + /** + * @param executeLifecycle the new invocation lifecycle of the Mojo + */ + public void setExecuteLifecycle( String executeLifecycle ) + { + this.executeLifecycle = executeLifecycle; + } + + /** + * @param aggregator true if the Mojo uses the Maven project and its child modules, + * false otherwise. + */ + public void setAggregator( boolean aggregator ) + { + this.aggregator = aggregator; + } + + /** + * @return true if the Mojo uses the Maven project and its child modules, + * false otherwise. + */ + public boolean isAggregator() + { + return aggregator; + } + + /** + * @return true if the Mojo cannot be invoked directly, false otherwise. + */ + public boolean isDirectInvocationOnly() + { + return directInvocationOnly; + } + + /** + * @param directInvocationOnly true if the Mojo cannot be invoked directly, + * false otherwise. + */ + public void setDirectInvocationOnly( boolean directInvocationOnly ) + { + this.directInvocationOnly = directInvocationOnly; + } + + /** + * @return true if the Mojo needs reports to run, false otherwise. + */ + public boolean isRequiresReports() + { + return requiresReports; + } + + /** + * @param requiresReports true if the Mojo needs reports to run, false otherwise. + */ + public void setRequiresReports( boolean requiresReports ) + { + this.requiresReports = requiresReports; + } + + /** + * @param executeGoal the new invocation goal of the Mojo + */ + public void setExecuteGoal( String executeGoal ) + { + this.executeGoal = executeGoal; + } + + /** + * @return the invocation goal of the Mojo + */ + public String getExecuteGoal() + { + return executeGoal; + } + + + /** + * @return True if the Mojo is thread-safe and can be run safely in parallel + * @since 3.0-beta-2 + */ + public boolean isThreadSafe() + { + return threadSafe; + } + + /** + * @param threadSafe indicates that the mojo is thread-safe and can be run safely in parallel + * @since 3.0-beta-2 + */ + public void setThreadSafe( boolean threadSafe ) + { + this.threadSafe = threadSafe; + } + + /** + * @return {@code true} if this mojo forks either a goal or the lifecycle, {@code false} otherwise. + */ + public boolean isForking() + { + return ( getExecuteGoal() != null && getExecuteGoal().length() > 0 ) + || ( getExecutePhase() != null && getExecutePhase().length() > 0 ); + } + + /** + * Creates a shallow copy of this mojo descriptor. + */ + @Override + public MojoDescriptor clone() + { + try + { + return (MojoDescriptor) super.clone(); + } + catch ( CloneNotSupportedException e ) + { + throw new UnsupportedOperationException( e ); + } + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java new file mode 100644 index 00000000..6c5036bc --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java @@ -0,0 +1,207 @@ +package org.apache.maven.plugin.descriptor; + +/* + * 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. + */ + +/** + * @author Jason van Zyl + */ +public class Parameter + implements Cloneable +{ + private String alias; + + private String name; + + private String type; + + private boolean required; + + private boolean editable = true; + + private String description; + + private String expression; + + private String deprecated; + + private String defaultValue; + + private String implementation; + + private Requirement requirement; + + private String since; + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + + public String getName() + { + return name; + } + + public void setName( String name ) + { + this.name = name; + } + + public String getType() + { + return type; + } + + public void setType( String type ) + { + this.type = type; + } + + public boolean isRequired() + { + return required; + } + + public void setRequired( boolean required ) + { + this.required = required; + } + + public String getDescription() + { + return description; + } + + public void setDescription( String description ) + { + this.description = description; + } + + public String getExpression() + { + return expression; + } + + public void setExpression( String expression ) + { + this.expression = expression; + } + + public String getDeprecated() + { + return deprecated; + } + + public void setDeprecated( String deprecated ) + { + this.deprecated = deprecated; + } + + public int hashCode() + { + return name.hashCode(); + } + + public boolean equals( Object other ) + { + return ( other instanceof Parameter ) && getName().equals( ( (Parameter) other ).getName() ); + } + + public String getAlias() + { + return alias; + } + + public void setAlias( String alias ) + { + this.alias = alias; + } + + public boolean isEditable() + { + return editable; + } + + public void setEditable( boolean editable ) + { + this.editable = editable; + } + + public void setDefaultValue( String defaultValue ) + { + this.defaultValue = defaultValue; + } + + public String getDefaultValue() + { + return defaultValue; + } + + public String toString() + { + return "Mojo parameter [name: \'" + getName() + "\'; alias: \'" + getAlias() + "\']"; + } + + public Requirement getRequirement() + { + return requirement; + } + + public void setRequirement( Requirement requirement ) + { + this.requirement = requirement; + } + + public String getImplementation() + { + return implementation; + } + + public void setImplementation( String implementation ) + { + this.implementation = implementation; + } + + public String getSince() + { + return since; + } + + public void setSince( String since ) + { + this.since = since; + } + + /** + * Creates a shallow copy of this parameter. + */ + @Override + public Parameter clone() + { + try + { + return (Parameter) super.clone(); + } + catch ( CloneNotSupportedException e ) + { + throw new UnsupportedOperationException( e ); + } + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java new file mode 100644 index 00000000..1d6f1be4 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java @@ -0,0 +1,445 @@ +package org.apache.maven.plugin.descriptor; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.model.Plugin; +import org.apache.maven.plugin.lifecycle.Lifecycle; +import org.apache.maven.plugin.lifecycle.LifecycleConfiguration; +import org.apache.maven.plugin.lifecycle.io.xpp3.LifecycleMappingsXpp3Reader; +import org.codehaus.plexus.classworlds.realm.ClassRealm; +import org.codehaus.plexus.component.repository.ComponentSetDescriptor; +import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * @author Jason van Zyl + */ +public class PluginDescriptor + extends ComponentSetDescriptor + implements Cloneable +{ + + private static final String LIFECYCLE_DESCRIPTOR = "META-INF/maven/lifecycle.xml"; + + private String groupId; + + private String artifactId; + + private String version; + + private String goalPrefix; + + private String source; + + private boolean inheritedByDefault = true; + + private List artifacts; + + private ClassRealm classRealm; + + // calculated on-demand. + private Map artifactMap; + + private Set introducedDependencyArtifacts; + + private String name; + + private String description; + + private String requiredMavenVersion; + + private Plugin plugin; + + private Artifact pluginArtifact; + + private Map lifecycleMappings; + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + + @SuppressWarnings( { "unchecked", "rawtypes" } ) + public List getMojos() + { + return (List) getComponents(); + } + + public void addMojo( MojoDescriptor mojoDescriptor ) + throws DuplicateMojoDescriptorException + { + MojoDescriptor existing = null; + // this relies heavily on the equals() and hashCode() for ComponentDescriptor, + // which uses role:roleHint for identity...and roleHint == goalPrefix:goal. + // role does not vary for Mojos. + List mojos = getMojos(); + + if ( mojos != null && mojos.contains( mojoDescriptor ) ) + { + int indexOf = mojos.indexOf( mojoDescriptor ); + + existing = mojos.get( indexOf ); + } + + if ( existing != null ) + { + throw new DuplicateMojoDescriptorException( getGoalPrefix(), mojoDescriptor.getGoal(), existing + .getImplementation(), mojoDescriptor.getImplementation() ); + } + else + { + addComponentDescriptor( mojoDescriptor ); + } + } + + public String getGroupId() + { + return groupId; + } + + public void setGroupId( String groupId ) + { + this.groupId = groupId; + } + + public String getArtifactId() + { + return artifactId; + } + + public void setArtifactId( String artifactId ) + { + this.artifactId = artifactId; + } + + // ---------------------------------------------------------------------- + // Dependencies + // ---------------------------------------------------------------------- + + public static String constructPluginKey( String groupId, String artifactId, String version ) + { + return groupId + ":" + artifactId + ":" + version; + } + + public String getPluginLookupKey() + { + return groupId + ":" + artifactId; + } + + public String getId() + { + return constructPluginKey( groupId, artifactId, version ); + } + + public static String getDefaultPluginArtifactId( String id ) + { + return "maven-" + id + "-plugin"; + } + + public static String getDefaultPluginGroupId() + { + return "org.apache.maven.plugins"; + } + + /** + * Parse maven-...-plugin. + * + * @todo move to plugin-tools-api as a default only + */ + public static String getGoalPrefixFromArtifactId( String artifactId ) + { + if ( "maven-plugin-plugin".equals( artifactId ) ) + { + return "plugin"; + } + else + { + return artifactId.replaceAll( "-?maven-?", "" ).replaceAll( "-?plugin-?", "" ); + } + } + + public String getGoalPrefix() + { + return goalPrefix; + } + + public void setGoalPrefix( String goalPrefix ) + { + this.goalPrefix = goalPrefix; + } + + public void setVersion( String version ) + { + this.version = version; + } + + public String getVersion() + { + return version; + } + + public void setSource( String source ) + { + this.source = source; + } + + public String getSource() + { + return source; + } + + public boolean isInheritedByDefault() + { + return inheritedByDefault; + } + + public void setInheritedByDefault( boolean inheritedByDefault ) + { + this.inheritedByDefault = inheritedByDefault; + } + + /** + * Gets the artifacts that make up the plugin's class realm, excluding artifacts shadowed by the Maven core realm + * like {@code maven-project}. + * + * @return The plugin artifacts, never {@code null}. + */ + public List getArtifacts() + { + return artifacts; + } + + public void setArtifacts( List artifacts ) + { + this.artifacts = artifacts; + + // clear the calculated artifactMap + artifactMap = null; + } + + /** + * The map of artifacts accessible by the versionlessKey, i.e. groupId:artifactId + * + * @return a Map of artifacts, never {@code null} + * @see #getArtifacts() + */ + public Map getArtifactMap() + { + if ( artifactMap == null ) + { + artifactMap = ArtifactUtils.artifactMapByVersionlessId( getArtifacts() ); + } + + return artifactMap; + } + + public boolean equals( Object object ) + { + if ( this == object ) + { + return true; + } + + return object instanceof PluginDescriptor && getId().equals( ( (PluginDescriptor) object ).getId() ); + } + + public int hashCode() + { + return 10 + getId().hashCode(); + } + + public MojoDescriptor getMojo( String goal ) + { + if ( getMojos() == null ) + { + return null; // no mojo in this POM + } + + // TODO: could we use a map? Maybe if the parent did that for components too, as this is too vulnerable to + // changes above not being propagated to the map + for ( MojoDescriptor desc : getMojos() ) + { + if ( goal.equals( desc.getGoal() ) ) + { + return desc; + } + } + return null; + } + + public void setClassRealm( ClassRealm classRealm ) + { + this.classRealm = classRealm; + } + + public ClassRealm getClassRealm() + { + return classRealm; + } + + public void setIntroducedDependencyArtifacts( Set introducedDependencyArtifacts ) + { + this.introducedDependencyArtifacts = introducedDependencyArtifacts; + } + + public Set getIntroducedDependencyArtifacts() + { + return ( introducedDependencyArtifacts != null ) ? introducedDependencyArtifacts + : Collections.emptySet(); + } + + public void setName( String name ) + { + this.name = name; + } + + public String getName() + { + return name; + } + + public void setDescription( String description ) + { + this.description = description; + } + + public String getDescription() + { + return description; + } + + public void setRequiredMavenVersion( String requiredMavenVersion ) + { + this.requiredMavenVersion = requiredMavenVersion; + } + + public String getRequiredMavenVersion() + { + return requiredMavenVersion; + } + + public void setPlugin( Plugin plugin ) + { + this.plugin = plugin; + } + + public Plugin getPlugin() + { + return plugin; + } + + public Artifact getPluginArtifact() + { + return pluginArtifact; + } + + public void setPluginArtifact( Artifact pluginArtifact ) + { + this.pluginArtifact = pluginArtifact; + } + + public Lifecycle getLifecycleMapping( String lifecycleId ) + throws IOException, XmlPullParserException + { + if ( lifecycleMappings == null ) + { + LifecycleConfiguration lifecycleConfiguration; + + Reader reader = null; + try + { + reader = ReaderFactory.newXmlReader( getDescriptorStream( LIFECYCLE_DESCRIPTOR ) ); + + lifecycleConfiguration = new LifecycleMappingsXpp3Reader().read( reader ); + } + finally + { + IOUtil.close( reader ); + } + + lifecycleMappings = new HashMap(); + + for ( Lifecycle lifecycle : lifecycleConfiguration.getLifecycles() ) + { + lifecycleMappings.put( lifecycle.getId(), lifecycle ); + } + } + + return lifecycleMappings.get( lifecycleId ); + } + + private InputStream getDescriptorStream( String descriptor ) + throws IOException + { + File pluginFile = ( pluginArtifact != null ) ? pluginArtifact.getFile() : null; + if ( pluginFile == null ) + { + throw new IllegalStateException( "plugin main artifact has not been resolved for " + getId() ); + } + + if ( pluginFile.isFile() ) + { + try + { + return new URL( "jar:" + pluginFile.toURI() + "!/" + descriptor ).openStream(); + } + catch ( MalformedURLException e ) + { + throw new IllegalStateException( e ); + } + } + else + { + return new FileInputStream( new File( pluginFile, descriptor ) ); + } + } + + /** + * Creates a shallow copy of this plugin descriptor. + */ + @Override + public PluginDescriptor clone() + { + try + { + return (PluginDescriptor) super.clone(); + } + catch ( CloneNotSupportedException e ) + { + throw new UnsupportedOperationException( e ); + } + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java new file mode 100644 index 00000000..66b16916 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java @@ -0,0 +1,358 @@ +package org.apache.maven.plugin.descriptor; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.IOException; +import java.io.Reader; +import java.util.ArrayList; +import java.util.List; + +import org.codehaus.plexus.component.repository.ComponentDependency; +import org.codehaus.plexus.component.repository.ComponentRequirement; +import org.codehaus.plexus.configuration.PlexusConfiguration; +import org.codehaus.plexus.configuration.PlexusConfigurationException; +import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; +import org.codehaus.plexus.util.xml.Xpp3DomBuilder; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * @author Jason van Zyl + */ +public class PluginDescriptorBuilder +{ + public PluginDescriptor build( Reader reader ) + throws PlexusConfigurationException + { + return build( reader, null ); + } + + public PluginDescriptor build( Reader reader, String source ) + throws PlexusConfigurationException + { + PlexusConfiguration c = buildConfiguration( reader ); + + PluginDescriptor pluginDescriptor = new PluginDescriptor(); + + pluginDescriptor.setSource( source ); + pluginDescriptor.setGroupId( c.getChild( "groupId" ).getValue() ); + pluginDescriptor.setArtifactId( c.getChild( "artifactId" ).getValue() ); + pluginDescriptor.setVersion( c.getChild( "version" ).getValue() ); + pluginDescriptor.setGoalPrefix( c.getChild( "goalPrefix" ).getValue() ); + + pluginDescriptor.setName( c.getChild( "name" ).getValue() ); + pluginDescriptor.setDescription( c.getChild( "description" ).getValue() ); + + String isolatedRealm = c.getChild( "isolatedRealm" ).getValue(); + + if ( isolatedRealm != null ) + { + pluginDescriptor.setIsolatedRealm( Boolean.parseBoolean( isolatedRealm ) ); + } + + String inheritedByDefault = c.getChild( "inheritedByDefault" ).getValue(); + + if ( inheritedByDefault != null ) + { + pluginDescriptor.setInheritedByDefault( Boolean.parseBoolean( inheritedByDefault ) ); + } + + // ---------------------------------------------------------------------- + // Components + // ---------------------------------------------------------------------- + + PlexusConfiguration[] mojoConfigurations = c.getChild( "mojos" ).getChildren( "mojo" ); + + for ( PlexusConfiguration component : mojoConfigurations ) + { + MojoDescriptor mojoDescriptor = buildComponentDescriptor( component, pluginDescriptor ); + + pluginDescriptor.addMojo( mojoDescriptor ); + } + + // ---------------------------------------------------------------------- + // Dependencies + // ---------------------------------------------------------------------- + + PlexusConfiguration[] dependencyConfigurations = c.getChild( "dependencies" ).getChildren( "dependency" ); + + List dependencies = new ArrayList(); + + for ( PlexusConfiguration d : dependencyConfigurations ) + { + ComponentDependency cd = new ComponentDependency(); + + cd.setArtifactId( d.getChild( "artifactId" ).getValue() ); + + cd.setGroupId( d.getChild( "groupId" ).getValue() ); + + cd.setType( d.getChild( "type" ).getValue() ); + + cd.setVersion( d.getChild( "version" ).getValue() ); + + dependencies.add( cd ); + } + + pluginDescriptor.setDependencies( dependencies ); + + return pluginDescriptor; + } + + public MojoDescriptor buildComponentDescriptor( PlexusConfiguration c, PluginDescriptor pluginDescriptor ) + throws PlexusConfigurationException + { + MojoDescriptor mojo = new MojoDescriptor(); + mojo.setPluginDescriptor( pluginDescriptor ); + + mojo.setGoal( c.getChild( "goal" ).getValue() ); + + mojo.setImplementation( c.getChild( "implementation" ).getValue() ); + + PlexusConfiguration langConfig = c.getChild( "language" ); + + if ( langConfig != null ) + { + mojo.setLanguage( langConfig.getValue() ); + } + + PlexusConfiguration configuratorConfig = c.getChild( "configurator" ); + + if ( configuratorConfig != null ) + { + mojo.setComponentConfigurator( configuratorConfig.getValue() ); + } + + PlexusConfiguration composerConfig = c.getChild( "composer" ); + + if ( composerConfig != null ) + { + mojo.setComponentComposer( composerConfig.getValue() ); + } + + String since = c.getChild( "since" ).getValue(); + + if ( since != null ) + { + mojo.setSince( since ); + } + + PlexusConfiguration deprecated = c.getChild( "deprecated", false ); + + if ( deprecated != null ) + { + mojo.setDeprecated( deprecated.getValue() ); + } + + String phase = c.getChild( "phase" ).getValue(); + + if ( phase != null ) + { + mojo.setPhase( phase ); + } + + String executePhase = c.getChild( "executePhase" ).getValue(); + + if ( executePhase != null ) + { + mojo.setExecutePhase( executePhase ); + } + + String executeMojo = c.getChild( "executeGoal" ).getValue(); + + if ( executeMojo != null ) + { + mojo.setExecuteGoal( executeMojo ); + } + + String executeLifecycle = c.getChild( "executeLifecycle" ).getValue(); + + if ( executeLifecycle != null ) + { + mojo.setExecuteLifecycle( executeLifecycle ); + } + + mojo.setInstantiationStrategy( c.getChild( "instantiationStrategy" ).getValue() ); + + mojo.setDescription( c.getChild( "description" ).getValue() ); + + PlexusConfiguration dependencyResolution = c.getChild( "requiresDependencyResolution", false ); + + if ( dependencyResolution != null ) + { + mojo.setDependencyResolutionRequired( dependencyResolution.getValue() ); + } + + PlexusConfiguration dependencyCollection = c.getChild( "requiresDependencyCollection", false ); + + if ( dependencyCollection != null ) + { + mojo.setDependencyCollectionRequired( dependencyCollection.getValue() ); + } + + String directInvocationOnly = c.getChild( "requiresDirectInvocation" ).getValue(); + + if ( directInvocationOnly != null ) + { + mojo.setDirectInvocationOnly( Boolean.parseBoolean( directInvocationOnly ) ); + } + + String requiresProject = c.getChild( "requiresProject" ).getValue(); + + if ( requiresProject != null ) + { + mojo.setProjectRequired( Boolean.parseBoolean( requiresProject ) ); + } + + String requiresReports = c.getChild( "requiresReports" ).getValue(); + + if ( requiresReports != null ) + { + mojo.setRequiresReports( Boolean.parseBoolean( requiresReports ) ); + } + + String aggregator = c.getChild( "aggregator" ).getValue(); + + if ( aggregator != null ) + { + mojo.setAggregator( Boolean.parseBoolean( aggregator ) ); + } + + String requiresOnline = c.getChild( "requiresOnline" ).getValue(); + + if ( requiresOnline != null ) + { + mojo.setOnlineRequired( Boolean.parseBoolean( requiresOnline ) ); + } + + String inheritedByDefault = c.getChild( "inheritedByDefault" ).getValue(); + + if ( inheritedByDefault != null ) + { + mojo.setInheritedByDefault( Boolean.parseBoolean( inheritedByDefault ) ); + } + + String threadSafe = c.getChild( "threadSafe" ).getValue(); + + if ( threadSafe != null ) + { + mojo.setThreadSafe( Boolean.parseBoolean( threadSafe ) ); + } + + // ---------------------------------------------------------------------- + // Configuration + // ---------------------------------------------------------------------- + + PlexusConfiguration mojoConfig = c.getChild( "configuration" ); + mojo.setMojoConfiguration( mojoConfig ); + + // ---------------------------------------------------------------------- + // Parameters + // ---------------------------------------------------------------------- + + PlexusConfiguration[] parameterConfigurations = c.getChild( "parameters" ).getChildren( "parameter" ); + + List parameters = new ArrayList(); + + for ( PlexusConfiguration d : parameterConfigurations ) + { + Parameter parameter = new Parameter(); + + parameter.setName( d.getChild( "name" ).getValue() ); + + parameter.setAlias( d.getChild( "alias" ).getValue() ); + + parameter.setType( d.getChild( "type" ).getValue() ); + + String required = d.getChild( "required" ).getValue(); + + parameter.setRequired( Boolean.parseBoolean( required ) ); + + PlexusConfiguration editableConfig = d.getChild( "editable" ); + + // we need the null check for pre-build legacy plugins... + if ( editableConfig != null ) + { + String editable = d.getChild( "editable" ).getValue(); + + parameter.setEditable( editable == null || Boolean.parseBoolean( editable ) ); + } + + parameter.setDescription( d.getChild( "description" ).getValue() ); + + parameter.setDeprecated( d.getChild( "deprecated" ).getValue() ); + + parameter.setImplementation( d.getChild( "implementation" ).getValue() ); + + PlexusConfiguration paramConfig = mojoConfig.getChild( parameter.getName(), false ); + if ( paramConfig != null ) + { + parameter.setExpression( paramConfig.getValue( null ) ); + parameter.setDefaultValue( paramConfig.getAttribute( "default-value" ) ); + } + + parameters.add( parameter ); + } + + mojo.setParameters( parameters ); + + // TODO: this should not need to be handed off... + + // ---------------------------------------------------------------------- + // Requirements + // ---------------------------------------------------------------------- + + PlexusConfiguration[] requirements = c.getChild( "requirements" ).getChildren( "requirement" ); + + for ( PlexusConfiguration requirement : requirements ) + { + ComponentRequirement cr = new ComponentRequirement(); + + cr.setRole( requirement.getChild( "role" ).getValue() ); + + cr.setRoleHint( requirement.getChild( "role-hint" ).getValue() ); + + cr.setFieldName( requirement.getChild( "field-name" ).getValue() ); + + mojo.addRequirement( cr ); + } + + return mojo; + } + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + + public PlexusConfiguration buildConfiguration( Reader configuration ) + throws PlexusConfigurationException + { + try + { + return new XmlPlexusConfiguration( Xpp3DomBuilder.build( configuration ) ); + } + catch ( IOException e ) + { + throw new PlexusConfigurationException( e.getMessage(), e ); + } + catch ( XmlPullParserException e ) + { + throw new PlexusConfigurationException( e.getMessage(), e ); + } + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/Requirement.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/Requirement.java new file mode 100644 index 00000000..1526b039 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/Requirement.java @@ -0,0 +1,72 @@ +package org.apache.maven.plugin.descriptor; + +/* + * 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. + */ + +/** + * Describes a component requirement. + * + * @author Brett Porter + */ +public class Requirement + implements Cloneable +{ + private final String role; + + private final String roleHint; + + public Requirement( String role ) + { + this.role = role; + this.roleHint = null; + } + + public Requirement( String role, String roleHint ) + { + this.role = role; + this.roleHint = roleHint; + } + + public String getRole() + { + return role; + } + + public String getRoleHint() + { + return roleHint; + } + + /** + * Creates a shallow copy of this requirement. + */ + @Override + public Requirement clone() + { + try + { + return (Requirement) super.clone(); + } + catch ( CloneNotSupportedException e ) + { + throw new UnsupportedOperationException( e ); + } + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/Log.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/Log.java new file mode 100644 index 00000000..8d3bf1f9 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/Log.java @@ -0,0 +1,158 @@ +package org.apache.maven.plugin.logging; + +/* + * 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. + */ + +/** + * This interface supplies the API for providing feedback to the user from the Mojo, using standard + * Maven channels. + *
+ * There should be no big surprises here, although you may notice that the methods accept + * java.lang.CharSequence rather than java.lang.String. This is provided mainly as a + * convenience, to enable developers to pass things like java.lang.StringBuffer directly into the logger, + * rather than formatting first by calling toString(). + * + * @author jdcasey + */ +public interface Log +{ + /** + * @return true if the debug error level is enabled + */ + boolean isDebugEnabled(); + + /** + * Send a message to the user in the debug error level. + * + * @param content + */ + void debug( CharSequence content ); + + /** + * Send a message (and accompanying exception) to the user in the debug error level. + *
+ * The error's stacktrace will be output when this error level is enabled. + * + * @param content + * @param error + */ + void debug( CharSequence content, Throwable error ); + + /** + * Send an exception to the user in the debug error level. + *
+ * The stack trace for this exception will be output when this error level is enabled. + * + * @param error + */ + void debug( Throwable error ); + + /** + * @return true if the info error level is enabled + */ + boolean isInfoEnabled(); + + /** + * Send a message to the user in the info error level. + * + * @param content + */ + void info( CharSequence content ); + + /** + * Send a message (and accompanying exception) to the user in the info error level. + *
+ * The error's stacktrace will be output when this error level is enabled. + * + * @param content + * @param error + */ + void info( CharSequence content, Throwable error ); + + /** + * Send an exception to the user in the info error level. + *
+ * The stack trace for this exception will be output when this error level is enabled. + * + * @param error + */ + void info( Throwable error ); + + /** + * @return true if the warn error level is enabled + */ + boolean isWarnEnabled(); + + /** + * Send a message to the user in the warn error level. + * + * @param content + */ + void warn( CharSequence content ); + + /** + * Send a message (and accompanying exception) to the user in the warn error level. + *
+ * The error's stacktrace will be output when this error level is enabled. + * + * @param content + * @param error + */ + void warn( CharSequence content, Throwable error ); + + /** + * Send an exception to the user in the warn error level. + *
+ * The stack trace for this exception will be output when this error level is enabled. + * + * @param error + */ + void warn( Throwable error ); + + /** + * @return true if the error error level is enabled + */ + boolean isErrorEnabled(); + + /** + * Send a message to the user in the error error level. + * + * @param content + */ + void error( CharSequence content ); + + /** + * Send a message (and accompanying exception) to the user in the error error level. + *
+ * The error's stacktrace will be output when this error level is enabled. + * + * @param content + * @param error + */ + void error( CharSequence content, Throwable error ); + + /** + * Send an exception to the user in the error error level. + *
+ * The stack trace for this exception will be output when this error level is enabled. + * + * @param error + */ + void error( Throwable error ); +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/SystemStreamLog.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/SystemStreamLog.java new file mode 100644 index 00000000..90475bf5 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/SystemStreamLog.java @@ -0,0 +1,196 @@ +package org.apache.maven.plugin.logging; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.PrintWriter; +import java.io.StringWriter; + +/** + * Logger with "standard" output and error output stream. + * + * @author jdcasey + */ +public class SystemStreamLog + implements Log +{ + /** + * @see org.apache.maven.plugin.logging.Log#debug(java.lang.CharSequence) + */ + public void debug( CharSequence content ) + { + print( "debug", content ); + } + + /** + * @see org.apache.maven.plugin.logging.Log#debug(java.lang.CharSequence, java.lang.Throwable) + */ + public void debug( CharSequence content, Throwable error ) + { + print( "debug", content, error ); + } + + /** + * @see org.apache.maven.plugin.logging.Log#debug(java.lang.Throwable) + */ + public void debug( Throwable error ) + { + print( "debug", error ); + } + + /** + * @see org.apache.maven.plugin.logging.Log#info(java.lang.CharSequence) + */ + public void info( CharSequence content ) + { + print( "info", content ); + } + + /** + * @see org.apache.maven.plugin.logging.Log#info(java.lang.CharSequence, java.lang.Throwable) + */ + public void info( CharSequence content, Throwable error ) + { + print( "info", content, error ); + } + + /** + * @see org.apache.maven.plugin.logging.Log#info(java.lang.Throwable) + */ + public void info( Throwable error ) + { + print( "info", error ); + } + + /** + * @see org.apache.maven.plugin.logging.Log#warn(java.lang.CharSequence) + */ + public void warn( CharSequence content ) + { + print( "warn", content ); + } + + /** + * @see org.apache.maven.plugin.logging.Log#warn(java.lang.CharSequence, java.lang.Throwable) + */ + public void warn( CharSequence content, Throwable error ) + { + print( "warn", content, error ); + } + + /** + * @see org.apache.maven.plugin.logging.Log#warn(java.lang.Throwable) + */ + public void warn( Throwable error ) + { + print( "warn", error ); + } + + /** + * @see org.apache.maven.plugin.logging.Log#error(java.lang.CharSequence) + */ + public void error( CharSequence content ) + { + System.err.println( "[error] " + content.toString() ); + } + + /** + * @see org.apache.maven.plugin.logging.Log#error(java.lang.CharSequence, java.lang.Throwable) + */ + public void error( CharSequence content, Throwable error ) + { + StringWriter sWriter = new StringWriter(); + PrintWriter pWriter = new PrintWriter( sWriter ); + + error.printStackTrace( pWriter ); + + System.err.println( "[error] " + content.toString() + "\n\n" + sWriter.toString() ); + } + + /** + * @see org.apache.maven.plugin.logging.Log#error(java.lang.Throwable) + */ + public void error( Throwable error ) + { + StringWriter sWriter = new StringWriter(); + PrintWriter pWriter = new PrintWriter( sWriter ); + + error.printStackTrace( pWriter ); + + System.err.println( "[error] " + sWriter.toString() ); + } + + /** + * @see org.apache.maven.plugin.logging.Log#isDebugEnabled() + */ + public boolean isDebugEnabled() + { + // TODO: Not sure how best to set these for this implementation... + return false; + } + + /** + * @see org.apache.maven.plugin.logging.Log#isInfoEnabled() + */ + public boolean isInfoEnabled() + { + return true; + } + + /** + * @see org.apache.maven.plugin.logging.Log#isWarnEnabled() + */ + public boolean isWarnEnabled() + { + return true; + } + + /** + * @see org.apache.maven.plugin.logging.Log#isErrorEnabled() + */ + public boolean isErrorEnabled() + { + return true; + } + + private void print( String prefix, CharSequence content ) + { + System.out.println( "[" + prefix + "] " + content.toString() ); + } + + private void print( String prefix, Throwable error ) + { + StringWriter sWriter = new StringWriter(); + PrintWriter pWriter = new PrintWriter( sWriter ); + + error.printStackTrace( pWriter ); + + System.out.println( "[" + prefix + "] " + sWriter.toString() ); + } + + private void print( String prefix, CharSequence content, Throwable error ) + { + StringWriter sWriter = new StringWriter(); + PrintWriter pWriter = new PrintWriter( sWriter ); + + error.printStackTrace( pWriter ); + + System.out.println( "[" + prefix + "] " + content.toString() + "\n\n" + sWriter.toString() ); + } +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/mdo/lifecycle.mdo b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/mdo/lifecycle.mdo new file mode 100644 index 00000000..2335d15c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/mdo/lifecycle.mdo @@ -0,0 +1,129 @@ + + + + lifecycle-mappings + LifecycleMappings + META-INF/maven/lifecycle.xml in a plugin's jar artifact. + ]]> + + + package + org.apache.maven.plugin.lifecycle + + + + + LifecycleConfiguration + 1.0.0 + lifecycle.xml file.]]> + + + lifecycles + 1.0.0 + + Lifecycle + * + + + + + + Lifecycle + 1.0.0 + + + + id + true + 1.0.0 + String + The ID of this lifecycle, for identification in the mojo descriptor. + + + phases + 1.0.0 + The phase mappings for this lifecycle. + + Phase + * + + + + + + Phase + 1.0.0 + A phase mapping definition. + + + id + true + 1.0.0 + String + The ID of this phase, eg <code>generate-sources</code>. + + + executions + 1.0.0 + The goals to execute within the phase. + + Execution + * + + + + configuration + 1.0.0 + DOM + Configuration to pass to all goals run in this phase. + + + + + Execution + 1.0.0 + A set of goals to execute. + + + configuration + 1.0.0 + DOM + Configuration to pass to the goals. + + + goals + 1.0.0 + The goals to execute. + + String + * + + + + + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/mdo/plugin.mdo b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/mdo/plugin.mdo new file mode 100644 index 00000000..83bf3bf3 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/main/mdo/plugin.mdo @@ -0,0 +1,525 @@ + + + + plugin + PluginDescriptor + META-INF/maven/plugin.xml in a plugin's jar artifact. + This descriptor is generally generated from plugin sources, using + maven-plugin-plugin. +

Notice: this documentation is generated from a Modello model but the code executed is not generated + from this descriptor. Please report if you find anything wrong.

+ ]]>
+ + + package + plugin descriptor XML documentation (no java generation) + + + + + PluginDescriptor + 1.0.0 + plugin.xml file.]]> + + + + name + 1.0.0 + Name of the plugin. + String + + + description + 1.0.0 + Description of the plugin. + String + + + groupId + 1.0.0 + The group id of the plugin. + String + + + artifactId + 1.0.0 + The artifact id of the plugin. + String + + + version + 1.0.0 + The version of the plugin. + String + + + goalPrefix + 1.0.0 + + String + + + isolatedRealm + 1.0.0 + + boolean + false + + + inheritedByDefault + 1.0.0 + + boolean + true + + + mojos + 1.0.0 + + MojoDescriptor + * + + Description of each Mojo provided by the plugin. + + + dependencies + 1.0.0 + + Dependency + * + + + A set of dependencies which the plugin requires in order to function. This enables the plugin to function + independently of its POM (or at least to declare the libraries it needs to run). + + + + + + + MojoDescriptor + 1.0.0 + + + + + goal + true + 1.0.0 + String + + The goal name for the Mojo, that users will reference from the command line to execute the Mojo directly, + or inside a POM in order to provide Mojo-specific configuration. + + + + description + 1.0.0 + String + The description of this Mojo's functionality. + + + implementation + 1.0.0 + String + + The Mojo's fully-qualified class name (or script path in the case of non-Java Mojos). + + + + language + 1.0.0 + String + java + The implementation language for this Mojo (java, beanshell, etc.). + + + phase + 1.0.0 + String + Note: This will not automagically make a mojo run when the plugin declaration is added + to the POM. It merely enables the user to omit the <phase> element from the + surrounding <execution> element. + ]]> + + + executePhase + 1.0.0 + String + Reference the invocation phase of the Mojo. + + + executeGoal + 1.0.0 + String + Reference the invocation goal of the Mojo. + + + executeLifecycle + 1.0.0 + String + + + + requiresDependencyResolution + 1.0.0 + String + runtime + compile, runtime, test, + compile+runtime (since Maven 3.0) or runtime+system (since Maven 3.0) + ]]> + + + requiresDependencyCollection + 1.0.0 + String + + + + requiresDirectInvocation + 1.0.0 + boolean + Flags this Mojo to be invoked directly only. + false + + + requiresProject + 1.0.0 + boolean + Flags this Mojo to require running inside of a project. + true + + + requiresReports + 1.0.0 + boolean + Flags this Mojo to require running inside of a reports context. Unsupported since Maven 3.0. + false + + + requiresOnline + 1.0.0 + boolean + Flags this Mojo to require online mode for its operation. + false + + + aggregator + 1.0.0 + boolean + + Flags this Mojo to run it in a multi module way, i.e. aggregate the build with the set of projects + listed as modules. + + false + + + inheritedByDefault + 1.0.0 + boolean + Specify that the Mojo is inherited. + true + + + threadSafe + 1.0.0 + boolean + + Marks this mojo as being thread-safe, i.e. the mojo safely supports concurrent execution during parallel + builds. Mojos without this annotation will make Maven output a warning when used during a parallel build + session. Since Maven 3.0. + + false + + + instantiationStrategy + 1.0.0 + String + per-lookup + Specify the instantiation strategy. + + + executionStrategy + 1.0.0 + String + once-per-session, always. + ]]> + once-per-session + + + since + 1.0.0 + String + Specify the version when the Mojo was added to the API. Similar to Javadoc since. + + + deprecated + 1.0.0 + String + + Specify the version when the Mojo was deprecated to the API. Similar to Javadoc deprecated. This will + trigger a warning when a user tries to configure a parameter marked as deprecated. + + + + configurator + 1.0.0 + String + + The configurator type to use when injecting parameter values into this Mojo. The value is normally deduced + from the Mojo's implementation language, but can be specified to allow a custom ComponentConfigurator + implementation to be used. + + + + composer + 1.0.0 + String + + + + parameters + 1.0.0 + + + Parameter + * + + + + configuration + 1.0.0 + + + Configuration + * + + + + requirements + 1.0.0 + + + Requirement + * + + + + + + + Parameter + 1.0.0 + A phase mapping definition. + + + + name + 1.0.0 + String + true + + The name of the parameter, to be used while configuring this parameter from the Mojo's declared defaults + or from the POM. + + + + alias + 1.0.0 + String + + Specifies an alias which can be used to configure this parameter from the POM. + This is primarily useful to improve user-friendliness, where Mojo field names are not intuitive to the + user or are otherwise not conducive to configuration via the POM. + + + + type + 1.0.0 + String + true + + The Java type for this parameter. This is used to validate the result of any expressions used to calculate + the value which should be injected into the Mojo for this parameter. + + + + required + 1.0.0 + boolean + + Whether this parameter is required for the Mojo to function. This is used to validate the configuration + for a Mojo before it is injected, and before the Mojo is executed from some half-state. + + + + editable + 1.0.0 + boolean + true + <build><finalName/></build> rather + than specifying a value for finalName directly in the plugin configuration section. It is also useful to + ensure that - for example - a List-typed parameter which expects items of type Artifact doesn't get a List + full of Strings. + ]]> + + + implementation + 1.0.0 + String + + + + description + 1.0.0 + String + The description of this parameter's use inside the Mojo. + + + since + 1.0.0 + String + Specify the version when the parameter was added to the API. Similar to Javadoc since. + + + deprecated + 1.0.0 + String + + Specify the version when the parameter was deprecated to the API. Similar to Javadoc deprecated. + This will trigger a warning when a user tries to configure a parameter marked as deprecated. + + + + + + + Configuration + 1.0.0 + A parameter configuration. + + + + expression + true + 1.0.0 + String + Parameter expression, to let user override default value with a system property, pom property or settings property. + + + implementation + 1.0.0 + String + + + + defaultValue + 1.0.0 + String + The default value, as an expression that will be evaluated at injection or run-time. + + + + + + Requirement + 1.0.0 + Describes a component requirement. + + + + role + true + 1.0.0 + String + + + + roleHint + 1.0.0 + String + + + + fieldName + true + 1.0.0 + String + The field name which has this requirement. + + + + + + Dependency + 1.0.0 + Definition of a dependency, needed by the plugin at runtime. + + + groupId + true + 1.0.0 + String + The group id of the dependency. + + + artifactId + true + 1.0.0 + String + The artifact id of the dependency. + + + version + 1.0.0 + String + The version of the dependency. + + + type + 1.0.0 + String + jar + The type of dependency. + + + + +
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/site/apt/index.apt b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/site/apt/index.apt new file mode 100644 index 00000000..6eb59556 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/site/apt/index.apt @@ -0,0 +1,39 @@ +~~ 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. + + ----- + Introduction + ----- + Hervé Boutemy + ----- + 2012-06-02 + ----- + +Maven Plugin API + + The API for plugins - composed of goals implemented by Mojos - development. + + A plugin is described in a {{{./plugin.html}<<>> plugin descriptor}}, + generally generated from plugin sources using {{{/plugin-tools/maven-plugin-plugin/}maven-plugin-plugin}}. + +* See Also + + * {{{/developers/mojo-api-specification.html}Mojo API Specification}} + + * {{{/plugin-tools/}plugin-tools}} + + * {{{/plugin-testing/}plugin-testing}} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/site/site.xml b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/site/site.xml new file mode 100644 index 00000000..9594af1b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/site/site.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilderTest.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilderTest.java new file mode 100644 index 00000000..799e3af0 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilderTest.java @@ -0,0 +1,133 @@ +package org.apache.maven.plugin.descriptor; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.IOException; +import java.io.Reader; + +import org.codehaus.plexus.component.repository.ComponentDependency; +import org.codehaus.plexus.component.repository.ComponentRequirement; +import org.codehaus.plexus.configuration.PlexusConfiguration; +import org.codehaus.plexus.configuration.PlexusConfigurationException; +import org.codehaus.plexus.util.ReaderFactory; + +import junit.framework.TestCase; + +/** + * Tests {@link PluginDescriptorBuilder}. + * + * @author Benjamin Bentmann + */ +public class PluginDescriptorBuilderTest + extends TestCase +{ + + private PluginDescriptor build( String resource ) + throws IOException, PlexusConfigurationException + { + Reader reader = ReaderFactory.newXmlReader( getClass().getResourceAsStream( resource ) ); + + return new PluginDescriptorBuilder().build( reader ); + } + + public void testBuildReader() + throws Exception + { + PluginDescriptor pd = build( "/plugin.xml" ); + + assertEquals( "org.apache.maven.plugins", pd.getGroupId() ); + assertEquals( "maven-jar-plugin", pd.getArtifactId() ); + assertEquals( "2.3-SNAPSHOT", pd.getVersion() ); + assertEquals( "jar", pd.getGoalPrefix() ); + assertEquals( "plugin-description", pd.getDescription() ); + assertEquals( false, pd.isIsolatedRealm() ); + assertEquals( true, pd.isInheritedByDefault() ); + assertEquals( 2, pd.getMojos().size() ); + assertEquals( 1, pd.getDependencies().size() ); + + MojoDescriptor md = pd.getMojos().get( 0 ); + + assertEquals( "jar", md.getGoal() ); + assertEquals( "mojo-description", md.getDescription() ); + assertEquals( "runtime", md.getDependencyResolutionRequired() ); + assertEquals( "test", md.getDependencyCollectionRequired() ); + assertEquals( false, md.isAggregator() ); + assertEquals( false, md.isDirectInvocationOnly() ); + assertEquals( true, md.isInheritedByDefault() ); + assertEquals( false, md.isOnlineRequired() ); + assertEquals( true, md.isProjectRequired() ); + assertEquals( false, md.isThreadSafe() ); + assertEquals( "package", md.getPhase() ); + assertEquals( "org.apache.maven.plugin.jar.JarMojo", md.getImplementation() ); + assertEquals( "antrun", md.getComponentConfigurator() ); + assertEquals( "java", md.getLanguage() ); + assertEquals( "per-lookup", md.getInstantiationStrategy() ); + assertEquals( "some-goal", md.getExecuteGoal() ); + assertEquals( "generate-sources", md.getExecutePhase() ); + assertEquals( "cobertura", md.getExecuteLifecycle() ); + assertEquals( "2.2", md.getSince() ); + assertEquals( "deprecated-mojo", md.getDeprecated() ); + assertEquals( 1, md.getRequirements().size() ); + assertEquals( 1, md.getParameters().size() ); + + assertNotNull( md.getMojoConfiguration() ); + assertEquals( 1, md.getMojoConfiguration().getChildCount() ); + + PlexusConfiguration pc = md.getMojoConfiguration().getChild( 0 ); + + assertEquals( "${jar.finalName}", pc.getValue() ); + assertEquals( "${project.build.finalName}", pc.getAttribute( "default-value" ) ); + assertEquals( "java.lang.String", pc.getAttribute( "implementation" ) ); + + Parameter mp = md.getParameters().get( 0 ); + + assertEquals( "finalName", mp.getName() ); + assertEquals( "jarName", mp.getAlias() ); + assertEquals( "java.lang.String", mp.getType() ); + assertEquals( "java.lang.String", mp.getImplementation() ); + assertEquals( true, mp.isEditable() ); + assertEquals( false, mp.isRequired() ); + assertEquals( "parameter-description", mp.getDescription() ); + assertEquals( "deprecated-parameter", mp.getDeprecated() ); + assertEquals( "${jar.finalName}", mp.getExpression() ); + assertEquals( "${project.build.finalName}", mp.getDefaultValue() ); + + ComponentRequirement cr = md.getRequirements().get( 0 ); + + assertEquals( "org.codehaus.plexus.archiver.Archiver", cr.getRole() ); + assertEquals( "jar", cr.getRoleHint() ); + assertEquals( "jarArchiver", cr.getFieldName() ); + + ComponentDependency cd = pd.getDependencies().get( 0 ); + + assertEquals( "org.apache.maven", cd.getGroupId() ); + assertEquals( "maven-plugin-api", cd.getArtifactId() ); + assertEquals( "2.0.6", cd.getVersion() ); + assertEquals( "jar", cd.getType() ); + + md = pd.getMojos().get( 1 ); + + assertEquals( "war", md.getGoal() ); + assertEquals( null, md.getDependencyResolutionRequired() ); + assertEquals( null, md.getDependencyCollectionRequired() ); + assertEquals( true, md.isThreadSafe() ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java new file mode 100644 index 00000000..18c02ecc --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java @@ -0,0 +1,55 @@ +package org.apache.maven.plugin.lifecycle; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.IOException; + +import junit.framework.TestCase; + +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * Test the lifecycle reader. + * + * @author Brett Porter + */ +public class LifecycleXpp3ReaderTest + extends TestCase +{ + public void testLifecycleReader() + throws IOException, XmlPullParserException + {/* + LifecycleMappingsXpp3Reader reader = new LifecycleMappingsXpp3Reader(); + LifecycleConfiguration config = reader.read( new InputStreamReader( getClass().getResourceAsStream( "/lifecycle.xml" ) ) ); + assertEquals( "check number of lifecycles", 1, config.getLifecycles().size() ); + Lifecycle l = (Lifecycle) config.getLifecycles().iterator().next(); + assertEquals( "check id", "clover", l.getId() ); + assertEquals( "check number of phases", 1, l.getPhases().size() ); + Phase p = (Phase) l.getPhases().iterator().next(); + assertEquals( "check id", "generate-sources", p.getId() ); + assertEquals( "check number of executions", 1, p.getExecutions().size() ); + Execution e = (Execution) p.getExecutions().iterator().next(); + assertEquals( "check configuration", "true", ((Xpp3Dom) e.getConfiguration()).getChild( "debug" ).getValue() ); + assertEquals( "check number of goals", 1, e.getGoals().size() ); + String g = (String) e.getGoals().iterator().next(); + assertEquals( "check goal", "clover:compiler", g ); + */ + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/resources/lifecycle.xml b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/resources/lifecycle.xml new file mode 100644 index 00000000..ebec5892 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/resources/lifecycle.xml @@ -0,0 +1,39 @@ + + + + + clover + + + generate-sources + + + + true + + + clover:compiler + + + + + + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/resources/plugin.xml b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/resources/plugin.xml new file mode 100644 index 00000000..6b972113 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-plugin-api/src/test/resources/plugin.xml @@ -0,0 +1,89 @@ + + + + + + plugin-description + org.apache.maven.plugins + maven-jar-plugin + 2.3-SNAPSHOT + jar + false + true + + + jar + mojo-description + runtime + test + false + true + false + false + false + true + package + org.apache.maven.plugin.jar.JarMojo + java + per-lookup + once-per-session + deprecated-mojo + 2.2 + generate-sources + some-goal + cobertura + antrun + + + finalName + jarName + java.lang.String + java.lang.String + false + true + parameter-description + deprecated-parameter + + + + ${jar.finalName} + + + + org.codehaus.plexus.archiver.Archiver + jar + jarArchiver + + + + + war + true + + + + + org.apache.maven + maven-plugin-api + jar + 2.0.6 + + + -- cgit 1.2.3-korg