This is an automated email from the ASF dual-hosted git repository. hboutemy pushed a commit to branch MNG-7652 in repository https://gitbox.apache.org/repos/asf/maven.git
commit 04571c64bb8c155bf52f17a925d1960f8333afd6 Author: Hervé Boutemy <[email protected]> AuthorDate: Sat Dec 31 16:42:41 2022 +0100 [MNG-7652] swtich to Modello Velocity --- api/maven-api-model/pom.xml | 30 ++--- api/maven-api-model/src/main/mdo/model.vm | 4 +- api/maven-api-settings/pom.xml | 30 ++--- api/maven-api-settings/src/main/mdo/model.vm | 4 +- api/maven-api-toolchain/pom.xml | 30 ++--- api/maven-api-toolchain/src/main/mdo/model.vm | 4 +- api/modello-plugin-velocity/pom.xml | 92 -------------- .../codehaus/modello/plugin/velocity/Helper.java | 130 -------------------- .../plugin/velocity/ModelloVelocityMojo.java | 80 ------------ .../modello/plugin/velocity/VelocityGenerator.java | 136 --------------------- .../main/resources/META-INF/plexus/components.xml | 31 ----- api/pom.xml | 22 +++- maven-compat/pom.xml | 10 ++ maven-embedder/pom.xml | 10 ++ maven-model/pom.xml | 70 ++++------- maven-model/src/main/mdo/merger.vm | 4 +- maven-model/src/main/mdo/model-v3.vm | 4 +- maven-model/src/main/mdo/reader-ex.vm | 4 +- maven-model/src/main/mdo/reader.vm | 4 +- maven-model/src/main/mdo/transformer.vm | 4 +- maven-model/src/main/mdo/writer-ex.vm | 4 +- maven-model/src/main/mdo/writer.vm | 4 +- maven-plugin-api/pom.xml | 35 ++---- maven-plugin-api/src/main/mdo/merger.vm | 4 +- maven-plugin-api/src/main/mdo/model.vm | 4 +- maven-plugin-api/src/main/mdo/reader.vm | 4 +- maven-plugin-api/src/main/mdo/writer.vm | 4 +- maven-repository-metadata/pom.xml | 10 ++ maven-settings/pom.xml | 17 +-- maven-settings/src/main/mdo/merger.vm | 4 +- maven-settings/src/main/mdo/model-v3.vm | 4 +- maven-settings/src/main/mdo/reader.vm | 4 +- maven-settings/src/main/mdo/writer.vm | 4 +- maven-toolchain-model/pom.xml | 17 +-- maven-toolchain-model/src/main/mdo/merger.vm | 4 +- maven-toolchain-model/src/main/mdo/model-v3.vm | 4 +- maven-toolchain-model/src/main/mdo/reader.vm | 4 +- maven-toolchain-model/src/main/mdo/writer.vm | 4 +- pom.xml | 14 +-- 39 files changed, 193 insertions(+), 659 deletions(-) diff --git a/api/maven-api-model/pom.xml b/api/maven-api-model/pom.xml index e141aac08..87d80b4cb 100644 --- a/api/maven-api-model/pom.xml +++ b/api/maven-api-model/pom.xml @@ -63,26 +63,26 @@ under the License. </executions> </plugin> <plugin> - <groupId>org.apache.maven</groupId> - <artifactId>modello-plugin-velocity</artifactId> - <configuration> - <version>4.2.0</version> - <models> - <model>src/main/mdo/maven.mdo</model> - </models> - <templates> - <template>src/main/mdo/model.vm</template> - </templates> - <params> - <param>packageModelV4=org.apache.maven.api.model</param> - </params> - </configuration> + <groupId>org.codehaus.modello</groupId> + <artifactId>modello-maven-plugin</artifactId> <executions> <execution> - <id>modello</id> + <id>velocity</id> <goals> <goal>velocity</goal> </goals> + <configuration> + <version>4.2.0</version> + <models> + <model>src/main/mdo/maven.mdo</model> + </models> + <templates> + <template>src/main/mdo/model.vm</template> + </templates> + <params> + <param>packageModelV4=org.apache.maven.api.model</param> + </params> + </configuration> </execution> </executions> </plugin> diff --git a/api/maven-api-model/src/main/mdo/model.vm b/api/maven-api-model/src/main/mdo/model.vm index 60f013dc1..aca095aa6 100644 --- a/api/maven-api-model/src/main/mdo/model.vm +++ b/api/maven-api-model/src/main/mdo/model.vm @@ -31,7 +31,7 @@ #set ( $dummy = $allFields.addAll( $cl.getFields($version) ) ) #end #set ( $className = "${class.name}" ) -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java #if ( $class.name != "InputLocation" && $class.name != "InputSource" ) #set ( $types = { } ) #set ( $imports = $class.getClass().forName("java.util.TreeSet").newInstance() ) @@ -85,7 +85,7 @@ #end #end // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/api/maven-api-settings/pom.xml b/api/maven-api-settings/pom.xml index 843274f0e..ae75044a5 100644 --- a/api/maven-api-settings/pom.xml +++ b/api/maven-api-settings/pom.xml @@ -63,26 +63,26 @@ under the License. </executions> </plugin> <plugin> - <groupId>org.apache.maven</groupId> - <artifactId>modello-plugin-velocity</artifactId> - <configuration> - <version>2.0.0</version> - <models> - <model>src/main/mdo/settings.mdo</model> - </models> - <templates> - <template>src/main/mdo/model.vm</template> - </templates> - <params> - <param>packageModelV4=org.apache.maven.api.settings</param> - </params> - </configuration> + <groupId>org.codehaus.modello</groupId> + <artifactId>modello-maven-plugin</artifactId> <executions> <execution> - <id>modello</id> + <id>velocity</id> <goals> <goal>velocity</goal> </goals> + <configuration> + <version>2.0.0</version> + <models> + <model>src/main/mdo/settings.mdo</model> + </models> + <templates> + <template>src/main/mdo/model.vm</template> + </templates> + <params> + <param>packageModelV4=org.apache.maven.api.settings</param> + </params> + </configuration> </execution> </executions> </plugin> diff --git a/api/maven-api-settings/src/main/mdo/model.vm b/api/maven-api-settings/src/main/mdo/model.vm index 60f013dc1..aca095aa6 100644 --- a/api/maven-api-settings/src/main/mdo/model.vm +++ b/api/maven-api-settings/src/main/mdo/model.vm @@ -31,7 +31,7 @@ #set ( $dummy = $allFields.addAll( $cl.getFields($version) ) ) #end #set ( $className = "${class.name}" ) -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java #if ( $class.name != "InputLocation" && $class.name != "InputSource" ) #set ( $types = { } ) #set ( $imports = $class.getClass().forName("java.util.TreeSet").newInstance() ) @@ -85,7 +85,7 @@ #end #end // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/api/maven-api-toolchain/pom.xml b/api/maven-api-toolchain/pom.xml index 20024cb8a..ea734f5dc 100644 --- a/api/maven-api-toolchain/pom.xml +++ b/api/maven-api-toolchain/pom.xml @@ -62,26 +62,26 @@ under the License. </executions> </plugin> <plugin> - <groupId>org.apache.maven</groupId> - <artifactId>modello-plugin-velocity</artifactId> - <configuration> - <version>1.1.0</version> - <models> - <model>src/main/mdo/toolchains.mdo</model> - </models> - <templates> - <template>src/main/mdo/model.vm</template> - </templates> - <params> - <param>packageModelV4=org.apache.maven.api.toolchain</param> - </params> - </configuration> + <groupId>org.codehaus.modello</groupId> + <artifactId>modello-maven-plugin</artifactId> <executions> <execution> - <id>modello</id> + <id>velocity</id> <goals> <goal>velocity</goal> </goals> + <configuration> + <version>1.1.0</version> + <models> + <model>src/main/mdo/toolchains.mdo</model> + </models> + <templates> + <template>src/main/mdo/model.vm</template> + </templates> + <params> + <param>packageModelV4=org.apache.maven.api.toolchain</param> + </params> + </configuration> </execution> </executions> </plugin> diff --git a/api/maven-api-toolchain/src/main/mdo/model.vm b/api/maven-api-toolchain/src/main/mdo/model.vm index 60f013dc1..aca095aa6 100644 --- a/api/maven-api-toolchain/src/main/mdo/model.vm +++ b/api/maven-api-toolchain/src/main/mdo/model.vm @@ -31,7 +31,7 @@ #set ( $dummy = $allFields.addAll( $cl.getFields($version) ) ) #end #set ( $className = "${class.name}" ) -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java #if ( $class.name != "InputLocation" && $class.name != "InputSource" ) #set ( $types = { } ) #set ( $imports = $class.getClass().forName("java.util.TreeSet").newInstance() ) @@ -85,7 +85,7 @@ #end #end // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/api/modello-plugin-velocity/pom.xml b/api/modello-plugin-velocity/pom.xml deleted file mode 100644 index d363ee1e4..000000000 --- a/api/modello-plugin-velocity/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.maven</groupId> - <artifactId>maven-api</artifactId> - <version>4.0.0-alpha-4-SNAPSHOT</version> - </parent> - - <artifactId>modello-plugin-velocity</artifactId> - <packaging>maven-plugin</packaging> - <name>Modello Velocity Plugin</name> - <description>Modello Velocity Plugin generates custom templates.</description> - - <dependencies> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - <version>3.4.2</version> - </dependency> - <dependency> - <groupId>org.apache.maven.plugin-tools</groupId> - <artifactId>maven-plugin-annotations</artifactId> - <version>3.6.4</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-plugin-api</artifactId> - <version>3.8.6</version> - <scope>provided</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-core</artifactId> - <version>3.8.6</version> - <scope>provided</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.codehaus.modello</groupId> - <artifactId>modello-maven-plugin</artifactId> - <version>2.0.0</version> - </dependency> - <dependency> - <groupId>org.apache.velocity</groupId> - <artifactId>velocity-engine-core</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>org.codehaus.modello</groupId> - <artifactId>modello-core</artifactId> - <version>2.0.0</version> - </dependency> - <dependency> - <groupId>org.codehaus.modello</groupId> - <artifactId>modello-plugin-xml</artifactId> - <version>2.0.0</version> - </dependency> - </dependencies> - -</project> diff --git a/api/modello-plugin-velocity/src/main/java/org/codehaus/modello/plugin/velocity/Helper.java b/api/modello-plugin-velocity/src/main/java/org/codehaus/modello/plugin/velocity/Helper.java deleted file mode 100644 index 39e04e59b..000000000 --- a/api/modello-plugin-velocity/src/main/java/org/codehaus/modello/plugin/velocity/Helper.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.codehaus.modello.plugin.velocity; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.modello.ModelloRuntimeException; -import org.codehaus.modello.model.ModelAssociation; -import org.codehaus.modello.model.ModelClass; -import org.codehaus.modello.model.ModelField; -import org.codehaus.modello.model.Version; -import org.codehaus.modello.plugin.AbstractModelloGenerator; -import org.codehaus.modello.plugins.xml.metadata.XmlAssociationMetadata; -import org.codehaus.modello.plugins.xml.metadata.XmlClassMetadata; -import org.codehaus.modello.plugins.xml.metadata.XmlFieldMetadata; -import org.codehaus.plexus.util.StringUtils; - -@SuppressWarnings("unused") -public class Helper { - private final Version version; - - public Helper(Version version) { - this.version = version; - } - - public String capitalise(String str) { - return StringUtils.isEmpty(str) ? str : Character.toTitleCase(str.charAt(0)) + str.substring(1); - } - - public String uncapitalise(String str) { - return StringUtils.isEmpty(str) ? str : Character.toLowerCase(str.charAt(0)) + str.substring(1); - } - - public String singular(String str) { - return AbstractModelloGenerator.singular(str); - } - - public List<ModelClass> ancestors(ModelClass clazz) { - List<ModelClass> ancestors = new ArrayList<>(); - for (ModelClass cl = clazz; - cl != null; - cl = cl.getSuperClass() != null ? cl.getModel().getClass(cl.getSuperClass(), version) : null) { - ancestors.add(0, cl); - } - return ancestors; - } - - public XmlClassMetadata xmlClassMetadata(ModelClass clazz) { - return (XmlClassMetadata) clazz.getMetadata(XmlClassMetadata.ID); - } - - public XmlFieldMetadata xmlFieldMetadata(ModelField field) { - return (XmlFieldMetadata) field.getMetadata(XmlFieldMetadata.ID); - } - - public XmlAssociationMetadata xmAssociationMetadata(ModelField field) { - return (XmlAssociationMetadata) ((ModelAssociation) field).getAssociationMetadata(XmlAssociationMetadata.ID); - } - - public boolean isFlatItems(ModelField field) { - return field instanceof ModelAssociation && xmAssociationMetadata(field).isFlatItems(); - } - - public List<ModelField> xmlFields(ModelClass modelClass) { - List<ModelClass> classes = new ArrayList<>(); - // get the full inheritance - while (modelClass != null) { - classes.add(modelClass); - String superClass = modelClass.getSuperClass(); - if (superClass != null) { - // superClass can be located outside (not generated by modello) - modelClass = modelClass.getModel().getClass(superClass, version, true); - } else { - modelClass = null; - } - } - List<ModelField> fields = new ArrayList<>(); - for (int i = classes.size() - 1; i >= 0; i--) { - modelClass = classes.get(i); - Iterator<ModelField> parentIter = fields.iterator(); - fields = new ArrayList<>(); - for (ModelField field : modelClass.getFields(version)) { - XmlFieldMetadata xmlFieldMetadata = (XmlFieldMetadata) field.getMetadata(XmlFieldMetadata.ID); - if (xmlFieldMetadata.isTransient()) { - // just ignore xml.transient fields - continue; - } - if (xmlFieldMetadata.getInsertParentFieldsUpTo() != null) { - // insert fields from parent up to the specified field - boolean found = false; - while (!found && parentIter.hasNext()) { - ModelField parentField = parentIter.next(); - fields.add(parentField); - found = parentField.getName().equals(xmlFieldMetadata.getInsertParentFieldsUpTo()); - } - if (!found) { - // interParentFieldsUpTo not found - throw new ModelloRuntimeException("parent field not found: class " - + modelClass.getName() + " xml.insertParentFieldUpTo='" - + xmlFieldMetadata.getInsertParentFieldsUpTo() + "'"); - } - } - fields.add(field); - } - // add every remaining fields from parent class - while (parentIter.hasNext()) { - fields.add(parentIter.next()); - } - } - return fields; - } -} diff --git a/api/modello-plugin-velocity/src/main/java/org/codehaus/modello/plugin/velocity/ModelloVelocityMojo.java b/api/modello-plugin-velocity/src/main/java/org/codehaus/modello/plugin/velocity/ModelloVelocityMojo.java deleted file mode 100644 index 2298252fe..000000000 --- a/api/modello-plugin-velocity/src/main/java/org/codehaus/modello/plugin/velocity/ModelloVelocityMojo.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.codehaus.modello.plugin.velocity; - -import java.io.File; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Properties; -import java.util.stream.Collectors; - -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.codehaus.modello.maven.AbstractModelloGeneratorMojo; - -/** - * Creates an XML schema from the model. - * - * @author <a href="mailto:[email protected]">Brett Porter</a> - */ -@Mojo(name = "velocity", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true) -public class ModelloVelocityMojo extends AbstractModelloGeneratorMojo { - /** - * The output directory of the generated XML Schema. - */ - @Parameter(defaultValue = "${project.build.directory}/generated-sources/modello", required = true) - private File outputDirectory; - - @Parameter - private List<String> templates; - - @Parameter - private List<String> params; - - protected String getGeneratorType() { - return "velocity"; - } - - protected void customizeParameters(Properties parameters) { - super.customizeParameters(parameters); - Map<String, String> params = this.params != null - ? this.params.stream() - .collect(Collectors.toMap( - s -> s.substring(0, s.indexOf('=')), s -> s.substring(s.indexOf('=') + 1))) - : Collections.emptyMap(); - parameters.put("basedir", Objects.requireNonNull(getBasedir(), "basedir is null")); - parameters.put(VelocityGenerator.VELOCITY_TEMPLATES, String.join(",", templates)); - parameters.put(VelocityGenerator.VELOCITY_PARAMETERS, params); - } - - protected boolean producesCompilableResult() { - return true; - } - - public File getOutputDirectory() { - return outputDirectory; - } - - public void setOutputDirectory(File outputDirectory) { - this.outputDirectory = outputDirectory; - } -} diff --git a/api/modello-plugin-velocity/src/main/java/org/codehaus/modello/plugin/velocity/VelocityGenerator.java b/api/modello-plugin-velocity/src/main/java/org/codehaus/modello/plugin/velocity/VelocityGenerator.java deleted file mode 100644 index 132a77a3b..000000000 --- a/api/modello-plugin-velocity/src/main/java/org/codehaus/modello/plugin/velocity/VelocityGenerator.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.codehaus.modello.plugin.velocity; - -import java.io.IOException; -import java.io.Writer; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Map; -import java.util.Objects; -import java.util.Properties; - -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.runtime.RuntimeInstance; -import org.codehaus.modello.ModelloException; -import org.codehaus.modello.ModelloParameterConstants; -import org.codehaus.modello.model.Model; -import org.codehaus.modello.model.Version; -import org.codehaus.modello.plugin.AbstractModelloGenerator; -import org.codehaus.plexus.util.io.CachingWriter; - -public class VelocityGenerator extends AbstractModelloGenerator { - public static final String VELOCITY_TEMPLATES = "modello.velocity.template"; - - public static final String VELOCITY_PARAMETERS = "modello.velocity.parameters"; - - @Override - public void generate(Model model, Properties parameters) throws ModelloException { - try { - Map<String, String> params = (Map) Objects.requireNonNull(parameters.get(VELOCITY_PARAMETERS)); - String templates = getParameter(parameters, VELOCITY_TEMPLATES); - String output = getParameter(parameters, ModelloParameterConstants.OUTPUT_DIRECTORY); - - Properties props = new Properties(); - props.put("resource.loader.file.path", getParameter(parameters, "basedir")); - RuntimeInstance velocity = new RuntimeInstance(); - velocity.init(props); - - VelocityContext context = new VelocityContext(); - for (Map.Entry<Object, Object> prop : parameters.entrySet()) { - context.put(prop.getKey().toString(), prop.getValue()); - } - for (Map.Entry<String, String> prop : params.entrySet()) { - context.put(prop.getKey(), prop.getValue()); - } - Version version = new Version(getParameter(parameters, ModelloParameterConstants.VERSION)); - context.put("version", version); - context.put("model", model); - context.put("Helper", new Helper(version)); - - for (String templatePath : templates.split(",")) { - Template template = velocity.getTemplate(templatePath); - - try (Writer w = new RedirectingWriter(Paths.get(output))) { - template.merge(context, w); - } - } - } catch (Exception e) { - throw new ModelloException("Unable to run velocity template", e); - } - } - - static class RedirectingWriter extends Writer { - Path dir; - StringBuilder sb = new StringBuilder(); - Writer current; - - RedirectingWriter(Path dir) { - this.dir = dir; - } - - @Override - public void write(char[] cbuf, int off, int len) throws IOException { - for (int i = 0; i < len; i++) { - if (cbuf[off + i] == '\n') { - if (sb.length() > 0 && sb.charAt(sb.length() - 1) == '\r') { - sb.setLength(sb.length() - 1); - } - writeLine(sb.toString()); - sb.setLength(0); - } else { - sb.append(cbuf[off + i]); - } - } - } - - protected void writeLine(String line) throws IOException { - if (line.startsWith("#MODELLO-VELOCITY#REDIRECT ")) { - String file = line.substring("#MODELLO-VELOCITY#REDIRECT ".length()); - if (current != null) { - current.close(); - } - Path out = dir.resolve(file); - Files.createDirectories(out.getParent()); - current = new CachingWriter(out, StandardCharsets.UTF_8); - } else if (current != null) { - current.write(line); - current.write("\n"); - } - } - - @Override - public void flush() throws IOException { - if (current != null) { - current.flush(); - } - } - - @Override - public void close() throws IOException { - if (current != null) { - current.close(); - current = null; - } - } - } -} diff --git a/api/modello-plugin-velocity/src/main/resources/META-INF/plexus/components.xml b/api/modello-plugin-velocity/src/main/resources/META-INF/plexus/components.xml deleted file mode 100644 index ed745b2fc..000000000 --- a/api/modello-plugin-velocity/src/main/resources/META-INF/plexus/components.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> - -<component-set> - <components> - <component> - <role>org.codehaus.modello.plugin.ModelloGenerator</role> - <role-hint>velocity</role-hint> - <implementation>org.codehaus.modello.plugin.velocity.VelocityGenerator</implementation> - <instantiation-strategy>per-lookup</instantiation-strategy> - </component> - </components> -</component-set> diff --git a/api/pom.xml b/api/pom.xml index d425fee16..e4076ff79 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -32,7 +32,6 @@ <description>A new immutable API for Maven 4 to better manage what plugins and extensions can influence.</description> <modules> - <module>modello-plugin-velocity</module> <module>maven-api-meta</module> <module>maven-api-xml</module> <module>maven-api-model</module> @@ -45,6 +44,27 @@ <project.directory>api</project.directory> </properties> + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.modello</groupId> + <artifactId>modello-maven-plugin</artifactId> + <executions> + <execution> + <id>modello-site-docs</id> + <goals> + <goal>xdoc</goal> + <goal>xsd</goal> + </goals> + <phase>none</phase> + </execution> + </executions> + </plugin> + </plugins> + </pluginManagement> + </build> + <profiles> <profile> <id>reporting</id> diff --git a/maven-compat/pom.xml b/maven-compat/pom.xml index c983778c9..3e29cd07e 100644 --- a/maven-compat/pom.xml +++ b/maven-compat/pom.xml @@ -144,6 +144,16 @@ under the License. <model>src/main/mdo/paramdoc.mdo</model> </models> </configuration> + <executions> + <execution> + <id>modello</id> + <goals> + <goal>java</goal> + <goal>xpp3-reader</goal> + <goal>xpp3-writer</goal> + </goals> + </execution> + </executions> </plugin> </plugins> </build> diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml index a6aaee43e..1a768672a 100644 --- a/maven-embedder/pom.xml +++ b/maven-embedder/pom.xml @@ -186,6 +186,16 @@ under the License. <model>src/main/mdo/core-extensions.mdo</model> </models> </configuration> + <executions> + <execution> + <id>modello</id> + <goals> + <goal>java</goal> + <goal>xpp3-reader</goal> + <goal>xpp3-writer</goal> + </goals> + </execution> + </executions> </plugin> </plugins> </build> diff --git a/maven-model/pom.xml b/maven-model/pom.xml index 7b7bf1379..8fbd8317b 100644 --- a/maven-model/pom.xml +++ b/maven-model/pom.xml @@ -49,10 +49,9 @@ under the License. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.2.0</version> <executions> <execution> - <id>copy-model</id> + <id>copy-maven.mdo</id> <goals> <goal>copy</goal> </goals> @@ -73,41 +72,49 @@ under the License. </executions> </plugin> <plugin> - <groupId>org.apache.maven</groupId> - <artifactId>modello-plugin-velocity</artifactId> + <groupId>org.codehaus.modello</groupId> + <artifactId>modello-maven-plugin</artifactId> + <configuration> + <version>4.0.0</version> + <models> + <model>target/mdo/maven.mdo</model> + </models> + <params> + <param>packageModelV3=org.apache.maven.model</param> + <param>packageModelV4=org.apache.maven.api.model</param> + <param>packageToolV4=org.apache.maven.model.v4</param> + </params> + </configuration> <executions> <execution> - <id>velocity-v3</id> + <id>modello-site-docs</id> + <goals> + <goal>xdoc</goal> + <goal>xsd</goal> + </goals> + <phase>pre-site</phase> + </execution> + <execution> + <id>model-v3</id> <goals> <goal>velocity</goal> </goals> <phase>generate-sources</phase> <configuration> <version>4.1.0</version> - <models> - <model>target/mdo/maven.mdo</model> - </models> <templates> <template>src/main/mdo/model-v3.vm</template> </templates> - <params> - <param>packageModelV3=org.apache.maven.model</param> - <param>packageModelV4=org.apache.maven.api.model</param> - <param>packageToolV4=org.apache.maven.model.v4</param> - </params> </configuration> </execution> <execution> - <id>velocity-v4</id> + <id>model-v4</id> <goals> <goal>velocity</goal> </goals> <phase>generate-sources</phase> <configuration> <version>4.2.0</version> - <models> - <model>target/mdo/maven.mdo</model> - </models> <templates> <template>src/main/mdo/merger.vm</template> <template>src/main/mdo/transformer.vm</template> @@ -116,39 +123,10 @@ under the License. <template>src/main/mdo/writer.vm</template> <template>src/main/mdo/writer-ex.vm</template> </templates> - <params> - <param>packageModelV3=org.apache.maven.model</param> - <param>packageModelV4=org.apache.maven.api.model</param> - <param>packageToolV4=org.apache.maven.model.v4</param> - </params> </configuration> </execution> </executions> </plugin> - <plugin> - <groupId>org.codehaus.modello</groupId> - <artifactId>modello-maven-plugin</artifactId> - <configuration> - <version>4.0.0</version> - <models> - <model>target/mdo/maven.mdo</model> - </models> - </configuration> - <executions> - <execution> - <id>modello-site-docs</id> - <goals> - <goal>xdoc</goal> - <goal>xsd</goal> - </goals> - <phase>pre-site</phase> - </execution> - <execution> - <id>modello</id> - <phase>none</phase> - </execution> - </executions> - </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> diff --git a/maven-model/src/main/mdo/merger.vm b/maven-model/src/main/mdo/merger.vm index 1394323f2..34e555145 100644 --- a/maven-model/src/main/mdo/merger.vm +++ b/maven-model/src/main/mdo/merger.vm @@ -23,9 +23,9 @@ # #set ( $root = $model.getClass( $model.getRoot($version), $version ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-model/src/main/mdo/model-v3.vm b/maven-model/src/main/mdo/model-v3.vm index e91bddbbe..6ded8683b 100644 --- a/maven-model/src/main/mdo/model-v3.vm +++ b/maven-model/src/main/mdo/model-v3.vm @@ -33,7 +33,7 @@ #set ( $dummy = $allFields.addAll( $cl.allFields ) ) #end #set ( $className = "${class.name}" ) -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java #if ( $class.name != "InputLocation" && $class.name != "InputSource" ) #set ( $types = { } ) #set ( $imports = $class.getClass().forName("java.util.TreeSet").newInstance() ) @@ -83,7 +83,7 @@ #end #end // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-model/src/main/mdo/reader-ex.vm b/maven-model/src/main/mdo/reader-ex.vm index af64eb727..3d7d3e16f 100644 --- a/maven-model/src/main/mdo/reader-ex.vm +++ b/maven-model/src/main/mdo/reader-ex.vm @@ -27,9 +27,9 @@ #set ( $rootUcapName = $Helper.capitalise( $root.name ) ) #set ( $rootLcapName = $Helper.uncapitalise( $root.name ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-model/src/main/mdo/reader.vm b/maven-model/src/main/mdo/reader.vm index 00069cf61..b1a65566a 100644 --- a/maven-model/src/main/mdo/reader.vm +++ b/maven-model/src/main/mdo/reader.vm @@ -27,9 +27,9 @@ #set ( $rootUcapName = $Helper.capitalise( $root.name ) ) #set ( $rootLcapName = $Helper.uncapitalise( $root.name ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-model/src/main/mdo/transformer.vm b/maven-model/src/main/mdo/transformer.vm index 032681864..fbb64b906 100644 --- a/maven-model/src/main/mdo/transformer.vm +++ b/maven-model/src/main/mdo/transformer.vm @@ -21,9 +21,9 @@ #set ( $package = "${packageToolV4}" ) #set ( $className = "${model.name}Transformer" ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-model/src/main/mdo/writer-ex.vm b/maven-model/src/main/mdo/writer-ex.vm index 1943287dd..087091c0d 100644 --- a/maven-model/src/main/mdo/writer-ex.vm +++ b/maven-model/src/main/mdo/writer-ex.vm @@ -27,9 +27,9 @@ #set ( $rootUcapName = $Helper.capitalise( $root.name ) ) #set ( $rootLcapName = $Helper.uncapitalise( $root.name ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-model/src/main/mdo/writer.vm b/maven-model/src/main/mdo/writer.vm index 75dfe0c58..fa9905aa5 100644 --- a/maven-model/src/main/mdo/writer.vm +++ b/maven-model/src/main/mdo/writer.vm @@ -27,9 +27,9 @@ #set ( $rootUcapName = $Helper.capitalise( $root.name ) ) #set ( $rootLcapName = $Helper.uncapitalise( $root.name ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-plugin-api/pom.xml b/maven-plugin-api/pom.xml index 3735068b8..4c4d92218 100644 --- a/maven-plugin-api/pom.xml +++ b/maven-plugin-api/pom.xml @@ -59,33 +59,12 @@ under the License. <plugin> <groupId>org.codehaus.modello</groupId> <artifactId>modello-maven-plugin</artifactId> - <version>2.0.0</version> <configuration> <models> <model>src/main/mdo/lifecycle.mdo</model> </models> <version>1.0.0</version> </configuration> - <executions> - <execution> - <id>modello</id> - <phase>none</phase> - </execution> - <execution> - <id>modello-site-docs</id> - <phase>pre-site</phase> - <configuration> - <models> - <model>src/main/mdo/plugin.mdo</model> - </models> - <version>1.1.0</version> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven</groupId> - <artifactId>modello-plugin-velocity</artifactId> <executions> <execution> <id>velocity</id> @@ -94,10 +73,6 @@ under the License. </goals> <phase>generate-sources</phase> <configuration> - <version>1.0.0</version> - <models> - <model>src/main/mdo/lifecycle.mdo</model> - </models> <templates> <template>src/main/mdo/model.vm</template> <template>src/main/mdo/reader.vm</template> @@ -110,6 +85,16 @@ under the License. </params> </configuration> </execution> + <execution> + <id>modello-site-docs</id> + <phase>pre-site</phase> + <configuration> + <models> + <model>src/main/mdo/plugin.mdo</model> + </models> + <version>1.1.0</version> + </configuration> + </execution> </executions> </plugin> <plugin> diff --git a/maven-plugin-api/src/main/mdo/merger.vm b/maven-plugin-api/src/main/mdo/merger.vm index e81c3baab..f302247f4 100644 --- a/maven-plugin-api/src/main/mdo/merger.vm +++ b/maven-plugin-api/src/main/mdo/merger.vm @@ -23,9 +23,9 @@ # #set ( $root = $model.getClass( $model.getRoot($version), $version ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-plugin-api/src/main/mdo/model.vm b/maven-plugin-api/src/main/mdo/model.vm index e995fa6e9..783d4eafa 100644 --- a/maven-plugin-api/src/main/mdo/model.vm +++ b/maven-plugin-api/src/main/mdo/model.vm @@ -31,7 +31,7 @@ #set ( $dummy = $allFields.addAll( $cl.getFields($version) ) ) #end #set ( $className = "${class.name}" ) -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java #if ( $class.name != "InputLocation" && $class.name != "InputSource" ) #set ( $types = { } ) #set ( $imports = $class.getClass().forName("java.util.TreeSet").newInstance() ) @@ -81,7 +81,7 @@ #end #end // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-plugin-api/src/main/mdo/reader.vm b/maven-plugin-api/src/main/mdo/reader.vm index a575b6534..7c4229b56 100644 --- a/maven-plugin-api/src/main/mdo/reader.vm +++ b/maven-plugin-api/src/main/mdo/reader.vm @@ -27,9 +27,9 @@ #set ( $rootUcapName = $Helper.capitalise( $root.name ) ) #set ( $rootLcapName = $Helper.uncapitalise( $root.name ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-plugin-api/src/main/mdo/writer.vm b/maven-plugin-api/src/main/mdo/writer.vm index b1bc5edde..05cd813d6 100644 --- a/maven-plugin-api/src/main/mdo/writer.vm +++ b/maven-plugin-api/src/main/mdo/writer.vm @@ -27,9 +27,9 @@ #set ( $rootUcapName = $Helper.capitalise( $root.name ) ) #set ( $rootLcapName = $Helper.uncapitalise( $root.name ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-repository-metadata/pom.xml b/maven-repository-metadata/pom.xml index 8ebec9710..26d7749cb 100644 --- a/maven-repository-metadata/pom.xml +++ b/maven-repository-metadata/pom.xml @@ -54,6 +54,16 @@ under the License. <model>src/main/mdo/metadata.mdo</model> </models> </configuration> + <executions> + <execution> + <id>modello</id> + <goals> + <goal>java</goal> + <goal>xpp3-reader</goal> + <goal>xpp3-writer</goal> + </goals> + </execution> + </executions> </plugin> </plugins> </build> diff --git a/maven-settings/pom.xml b/maven-settings/pom.xml index 8b77d69b7..4c1501838 100644 --- a/maven-settings/pom.xml +++ b/maven-settings/pom.xml @@ -53,10 +53,9 @@ under the License. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.2.0</version> <executions> <execution> - <id>copy-model</id> + <id>copy-settings.mdo</id> <goals> <goal>copy</goal> </goals> @@ -77,8 +76,14 @@ under the License. </executions> </plugin> <plugin> - <groupId>org.apache.maven</groupId> - <artifactId>modello-plugin-velocity</artifactId> + <groupId>org.codehaus.modello</groupId> + <artifactId>modello-maven-plugin</artifactId> + <configuration> + <version>4.0.0</version> + <models> + <model>target/mdo/settings.mdo</model> + </models> + </configuration> <executions> <execution> <id>velocity</id> @@ -87,10 +92,6 @@ under the License. </goals> <phase>generate-sources</phase> <configuration> - <version>4.0.0</version> - <models> - <model>target/mdo/settings.mdo</model> - </models> <templates> <template>src/main/mdo/model-v3.vm</template> <template>src/main/mdo/merger.vm</template> diff --git a/maven-settings/src/main/mdo/merger.vm b/maven-settings/src/main/mdo/merger.vm index 407ca8638..6b7605184 100644 --- a/maven-settings/src/main/mdo/merger.vm +++ b/maven-settings/src/main/mdo/merger.vm @@ -23,9 +23,9 @@ # #set ( $root = $model.getClass( $model.getRoot($version), $version ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-settings/src/main/mdo/model-v3.vm b/maven-settings/src/main/mdo/model-v3.vm index 0271ae33b..9e06cff9b 100644 --- a/maven-settings/src/main/mdo/model-v3.vm +++ b/maven-settings/src/main/mdo/model-v3.vm @@ -33,7 +33,7 @@ #set ( $dummy = $allFields.addAll( $cl.allFields ) ) #end #set ( $className = "${class.name}" ) -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java #if ( $class.name != "InputLocation" && $class.name != "InputSource" ) #set ( $types = { } ) #set ( $imports = $class.getClass().forName("java.util.TreeSet").newInstance() ) @@ -82,7 +82,7 @@ #end #end // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-settings/src/main/mdo/reader.vm b/maven-settings/src/main/mdo/reader.vm index 91c17e584..feae630a9 100644 --- a/maven-settings/src/main/mdo/reader.vm +++ b/maven-settings/src/main/mdo/reader.vm @@ -27,9 +27,9 @@ #set ( $rootUcapName = $Helper.capitalise( $root.name ) ) #set ( $rootLcapName = $Helper.uncapitalise( $root.name ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-settings/src/main/mdo/writer.vm b/maven-settings/src/main/mdo/writer.vm index 75dfe0c58..fa9905aa5 100644 --- a/maven-settings/src/main/mdo/writer.vm +++ b/maven-settings/src/main/mdo/writer.vm @@ -27,9 +27,9 @@ #set ( $rootUcapName = $Helper.capitalise( $root.name ) ) #set ( $rootLcapName = $Helper.uncapitalise( $root.name ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-toolchain-model/pom.xml b/maven-toolchain-model/pom.xml index 9a72225a1..222265ea3 100644 --- a/maven-toolchain-model/pom.xml +++ b/maven-toolchain-model/pom.xml @@ -52,10 +52,9 @@ under the License. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.2.0</version> <executions> <execution> - <id>copy-model</id> + <id>copy-toolchains.mdo</id> <goals> <goal>copy</goal> </goals> @@ -76,8 +75,14 @@ under the License. </executions> </plugin> <plugin> - <groupId>org.apache.maven</groupId> - <artifactId>modello-plugin-velocity</artifactId> + <groupId>org.codehaus.modello</groupId> + <artifactId>modello-maven-plugin</artifactId> + <configuration> + <version>4.0.0</version> + <models> + <model>target/mdo/toolchains.mdo</model> + </models> + </configuration> <executions> <execution> <id>velocity</id> @@ -86,10 +91,6 @@ under the License. </goals> <phase>generate-sources</phase> <configuration> - <version>4.0.0</version> - <models> - <model>target/mdo/toolchains.mdo</model> - </models> <templates> <template>src/main/mdo/model-v3.vm</template> <template>src/main/mdo/merger.vm</template> diff --git a/maven-toolchain-model/src/main/mdo/merger.vm b/maven-toolchain-model/src/main/mdo/merger.vm index 407ca8638..6b7605184 100644 --- a/maven-toolchain-model/src/main/mdo/merger.vm +++ b/maven-toolchain-model/src/main/mdo/merger.vm @@ -23,9 +23,9 @@ # #set ( $root = $model.getClass( $model.getRoot($version), $version ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-toolchain-model/src/main/mdo/model-v3.vm b/maven-toolchain-model/src/main/mdo/model-v3.vm index 0271ae33b..9e06cff9b 100644 --- a/maven-toolchain-model/src/main/mdo/model-v3.vm +++ b/maven-toolchain-model/src/main/mdo/model-v3.vm @@ -33,7 +33,7 @@ #set ( $dummy = $allFields.addAll( $cl.allFields ) ) #end #set ( $className = "${class.name}" ) -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java #if ( $class.name != "InputLocation" && $class.name != "InputSource" ) #set ( $types = { } ) #set ( $imports = $class.getClass().forName("java.util.TreeSet").newInstance() ) @@ -82,7 +82,7 @@ #end #end // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-toolchain-model/src/main/mdo/reader.vm b/maven-toolchain-model/src/main/mdo/reader.vm index 91c17e584..feae630a9 100644 --- a/maven-toolchain-model/src/main/mdo/reader.vm +++ b/maven-toolchain-model/src/main/mdo/reader.vm @@ -27,9 +27,9 @@ #set ( $rootUcapName = $Helper.capitalise( $root.name ) ) #set ( $rootLcapName = $Helper.uncapitalise( $root.name ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/maven-toolchain-model/src/main/mdo/writer.vm b/maven-toolchain-model/src/main/mdo/writer.vm index 75dfe0c58..fa9905aa5 100644 --- a/maven-toolchain-model/src/main/mdo/writer.vm +++ b/maven-toolchain-model/src/main/mdo/writer.vm @@ -27,9 +27,9 @@ #set ( $rootUcapName = $Helper.capitalise( $root.name ) ) #set ( $rootLcapName = $Helper.uncapitalise( $root.name ) ) # -#MODELLO-VELOCITY#REDIRECT ${package.replace('.','/')}/${className}.java +#MODELLO-VELOCITY#SAVE-OUTPUT-TO ${package.replace('.','/')}/${className}.java // =================== DO NOT EDIT THIS FILE ==================== -// Generated by Maven, any modifications will be overwritten. +// ${generatedBy} // ============================================================== package ${package}; diff --git a/pom.xml b/pom.xml index 7a4ecbd65..36820f12e 100644 --- a/pom.xml +++ b/pom.xml @@ -492,11 +492,6 @@ under the License. <build> <pluginManagement> <plugins> - <plugin> - <groupId>org.apache.maven</groupId> - <artifactId>modello-plugin-velocity</artifactId> - <version>${project.version}</version> - </plugin> <plugin> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-component-metadata</artifactId> @@ -530,6 +525,7 @@ under the License. <plugin> <groupId>org.codehaus.modello</groupId> <artifactId>modello-maven-plugin</artifactId> + <version>2.1.0</version> <executions> <execution> <id>modello-site-docs</id> @@ -539,14 +535,6 @@ under the License. </goals> <phase>pre-site</phase> </execution> - <execution> - <id>modello</id> - <goals> - <goal>java</goal> - <goal>xpp3-reader</goal> - <goal>xpp3-writer</goal> - </goals> - </execution> </executions> </plugin> <plugin>
