From 7161cfa189ea1519fb4756901d51340494b8d639 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Mon, 10 Jun 2024 21:51:46 +0200 Subject: [PATCH] [MNG-8153] Add back missing classes from the v3 api (#1577) --- .../maven/plugin/lifecycle/Execution.java | 104 ++++++++++++++ .../maven/plugin/lifecycle/Lifecycle.java | 109 +++++++++++++++ .../lifecycle/LifecycleConfiguration.java | 104 ++++++++++++++ .../apache/maven/plugin/lifecycle/Phase.java | 129 ++++++++++++++++++ 4 files changed, 446 insertions(+) create mode 100644 maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/Execution.java create mode 100644 maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/Lifecycle.java create mode 100644 maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/LifecycleConfiguration.java create mode 100644 maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/Phase.java diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/Execution.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/Execution.java new file mode 100644 index 000000000000..7ef46425eb9c --- /dev/null +++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/Execution.java @@ -0,0 +1,104 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.lifecycle; + +/** + * A set of goals to execute. + * + * @version $Revision$ $Date$ + */ +@SuppressWarnings("all") +public class Execution implements java.io.Serializable { + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Configuration to pass to the goals. + */ + private Object configuration; + + /** + * Field goals. + */ + private java.util.List goals; + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method addGoal. + * + * @param string a string object. + */ + public void addGoal(String string) { + getGoals().add(string); + } // -- void addGoal( String ) + + /** + * Get configuration to pass to the goals. + * + * @return Object + */ + public Object getConfiguration() { + return this.configuration; + } // -- Object getConfiguration() + + /** + * Method getGoals. + * + * @return List + */ + public java.util.List getGoals() { + if (this.goals == null) { + this.goals = new java.util.ArrayList(); + } + + return this.goals; + } // -- java.util.List getGoals() + + /** + * Method removeGoal. + * + * @param string a string object. + */ + public void removeGoal(String string) { + getGoals().remove(string); + } // -- void removeGoal( String ) + + /** + * Set configuration to pass to the goals. + * + * @param configuration a configuration object. + */ + public void setConfiguration(Object configuration) { + this.configuration = configuration; + } // -- void setConfiguration( Object ) + + /** + * Set the goals to execute. + * + * @param goals a goals object. + */ + public void setGoals(java.util.List goals) { + this.goals = goals; + } // -- void setGoals( java.util.List ) +} diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/Lifecycle.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/Lifecycle.java new file mode 100644 index 000000000000..df6c225729bf --- /dev/null +++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/Lifecycle.java @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.lifecycle; + +/** + * + * A custom lifecycle mapping definition. + * + * + * @version $Revision$ $Date$ + */ +@SuppressWarnings("all") +public class Lifecycle implements java.io.Serializable { + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * The ID of this lifecycle, for identification in the mojo + * descriptor. + */ + private String id; + + /** + * Field phases. + */ + private java.util.List phases; + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method addPhase. + * + * @param phase a phase object. + */ + public void addPhase(Phase phase) { + getPhases().add(phase); + } // -- void addPhase( Phase ) + + /** + * Get the ID of this lifecycle, for identification in the mojo + * descriptor. + * + * @return String + */ + public String getId() { + return this.id; + } // -- String getId() + + /** + * Method getPhases. + * + * @return List + */ + public java.util.List getPhases() { + if (this.phases == null) { + this.phases = new java.util.ArrayList(); + } + + return this.phases; + } // -- java.util.List getPhases() + + /** + * Method removePhase. + * + * @param phase a phase object. + */ + public void removePhase(Phase phase) { + getPhases().remove(phase); + } // -- void removePhase( Phase ) + + /** + * Set the ID of this lifecycle, for identification in the mojo + * descriptor. + * + * @param id a id object. + */ + public void setId(String id) { + this.id = id; + } // -- void setId( String ) + + /** + * Set the phase mappings for this lifecycle. + * + * @param phases a phases object. + */ + public void setPhases(java.util.List phases) { + this.phases = phases; + } // -- void setPhases( java.util.List ) +} diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/LifecycleConfiguration.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/LifecycleConfiguration.java new file mode 100644 index 000000000000..bde244cf110d --- /dev/null +++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/LifecycleConfiguration.java @@ -0,0 +1,104 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.lifecycle; + +/** + * Root element of the lifecycle.xml file. + * + * @version $Revision$ $Date$ + */ +@SuppressWarnings("all") +public class LifecycleConfiguration implements java.io.Serializable { + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field lifecycles. + */ + private java.util.List lifecycles; + + /** + * Field modelEncoding. + */ + private String modelEncoding = "UTF-8"; + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method addLifecycle. + * + * @param lifecycle a lifecycle object. + */ + public void addLifecycle(Lifecycle lifecycle) { + getLifecycles().add(lifecycle); + } // -- void addLifecycle( Lifecycle ) + + /** + * Method getLifecycles. + * + * @return List + */ + public java.util.List getLifecycles() { + if (this.lifecycles == null) { + this.lifecycles = new java.util.ArrayList(); + } + + return this.lifecycles; + } // -- java.util.List getLifecycles() + + /** + * Get the modelEncoding field. + * + * @return String + */ + public String getModelEncoding() { + return this.modelEncoding; + } // -- String getModelEncoding() + + /** + * Method removeLifecycle. + * + * @param lifecycle a lifecycle object. + */ + public void removeLifecycle(Lifecycle lifecycle) { + getLifecycles().remove(lifecycle); + } // -- void removeLifecycle( Lifecycle ) + + /** + * Set the lifecycles field. + * + * @param lifecycles a lifecycles object. + */ + public void setLifecycles(java.util.List lifecycles) { + this.lifecycles = lifecycles; + } // -- void setLifecycles( java.util.List ) + + /** + * Set the modelEncoding field. + * + * @param modelEncoding a modelEncoding object. + */ + public void setModelEncoding(String modelEncoding) { + this.modelEncoding = modelEncoding; + } // -- void setModelEncoding( String ) +} diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/Phase.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/Phase.java new file mode 100644 index 000000000000..e5731a1936cb --- /dev/null +++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/Phase.java @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.lifecycle; + +/** + * A phase mapping definition. + * + * @version $Revision$ $Date$ + */ +@SuppressWarnings("all") +public class Phase implements java.io.Serializable { + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * The ID of this phase, e.g., generate-sources. + */ + private String id; + + /** + * Field executions. + */ + private java.util.List executions; + + /** + * Configuration to pass to all goals run in this phase. + */ + private Object configuration; + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method addExecution. + * + * @param execution a execution object. + */ + public void addExecution(Execution execution) { + getExecutions().add(execution); + } // -- void addExecution( Execution ) + + /** + * Get configuration to pass to all goals run in this phase. + * + * @return Object + */ + public Object getConfiguration() { + return this.configuration; + } // -- Object getConfiguration() + + /** + * Method getExecutions. + * + * @return List + */ + public java.util.List getExecutions() { + if (this.executions == null) { + this.executions = new java.util.ArrayList(); + } + + return this.executions; + } // -- java.util.List getExecutions() + + /** + * Get the ID of this phase, e.g., + * generate-sources. + * + * @return String + */ + public String getId() { + return this.id; + } // -- String getId() + + /** + * Method removeExecution. + * + * @param execution a execution object. + */ + public void removeExecution(Execution execution) { + getExecutions().remove(execution); + } // -- void removeExecution( Execution ) + + /** + * Set configuration to pass to all goals run in this phase. + * + * @param configuration a configuration object. + */ + public void setConfiguration(Object configuration) { + this.configuration = configuration; + } // -- void setConfiguration( Object ) + + /** + * Set the goals to execute within the phase. + * + * @param executions a executions object. + */ + public void setExecutions(java.util.List executions) { + this.executions = executions; + } // -- void setExecutions( java.util.List ) + + /** + * Set the ID of this phase, e.g., + * generate-sources. + * + * @param id a id object. + */ + public void setId(String id) { + this.id = id; + } // -- void setId( String ) +}