Author: tv Date: Fri Jan 4 07:45:22 2019 New Revision: 1850320 URL: http://svn.apache.org/viewvc?rev=1850320&view=rev Log: Switch to annotations
Modified: db/torque/torque4/trunk/torque-maven-plugin/pom.xml db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java Modified: db/torque/torque4/trunk/torque-maven-plugin/pom.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-maven-plugin/pom.xml?rev=1850320&r1=1850319&r2=1850320&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-maven-plugin/pom.xml (original) +++ db/torque/torque4/trunk/torque-maven-plugin/pom.xml Fri Jan 4 07:45:22 2019 @@ -49,6 +49,13 @@ <version>${maven.api.version}</version> </dependency> <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> + <version>3.6.0</version> + <!-- annotations are not used at runtime because @Retention(value=CLASS), they are needed only to build the plugin --> + <optional>true</optional> + </dependency> + <dependency> <!-- We do not depend on any xerces features. However, the standard xml parser packaged in java is sometimes buggy (e.g.1.6.0_20 on windows) Modified: db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java?rev=1850320&r1=1850319&r2=1850320&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java (original) +++ db/torque/torque4/trunk/torque-maven-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java Fri Jan 4 07:45:22 2019 @@ -31,8 +31,10 @@ import java.util.Set; import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.Mojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.torque.generator.configuration.ConfigurationException; import org.apache.torque.generator.configuration.UnitDescriptor; @@ -55,9 +57,9 @@ import org.apache.torque.generator.sourc * * $Id$ * - * @goal generate */ -public class TorqueGeneratorMojo extends AbstractMojo implements Mojo +@Mojo( name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES ) +public class TorqueGeneratorMojo extends AbstractMojo { /** Possible usages for generator output directories. */ private enum OutputDirUsage @@ -139,42 +141,35 @@ public class TorqueGeneratorMojo extends /** * The packaging type of the generation unit, either "directory" , "jar" * or "classpath". - * - * @parameter property="directory" - * @required */ + @Parameter(defaultValue = "directory", required = true) private String packaging; /** * The root directory of the project. * Has no effect if packaging is "classpath". - * - * @parameter property="${basedir}" - * @required */ + @Parameter(defaultValue = "${basedir}", required = true) private File projectRootDir; /** * The configuration directory of the generation unit. * Has no effect if packaging is "classpath". - * - * @parameter */ + @Parameter private File configDir; /** * The configuration package of the generation unit. * Has only effect if packaging is "classpath". - * - * @parameter */ + @Parameter private String configPackage; /** * The directory where the source files reside. - * - * @parameter */ + @Parameter private File sourceDir; /** @@ -183,9 +178,8 @@ public class TorqueGeneratorMojo extends * are overridden. * If not set, then the include patterns from the templates are used. * The patterns are case sensitive, wildcards are * and ?. - * - * @parameter */ + @Parameter private Set<String> sourceIncludes; /** @@ -194,9 +188,8 @@ public class TorqueGeneratorMojo extends * are overridden. * If not set, then the include patterns from the templates are used. * The patterns are case sensitive, wildcards are * and ?. - * - * @parameter */ + @Parameter private Set<String> sourceExcludes; /** @@ -219,19 +212,16 @@ public class TorqueGeneratorMojo extends * ... * </source> * If not set, the settings from the templates will be used. - * - * @parameter */ + @Parameter private Boolean combineFiles; /** * The default base output directory for the generated files. * Whether the configured templates use this directory or not, * is up to the templates; check the template documentation. - * - * @parameter property="${project.build.directory}/generated-sources" - * @required */ + @Parameter(defaultValue = "${project.build.directory}/generated-sources", required = true) private File defaultOutputDir; /** @@ -242,24 +232,21 @@ public class TorqueGeneratorMojo extends * is up to the templates; check the template documentation. * Default is to map the key "modifiable" to * ${project.build.directory}/src/main/generated-java - * - * @parameter */ + @Parameter private Map<String, String> outputDirMap = new HashMap<>(); /** * The work directory for e.g. merge sources. - * - * @parameter property="${basedir}/src/main/torque-gen/work" */ + @Parameter(defaultValue = "${basedir}/src/main/torque-gen/work") private File workDir; /** * The filename of the jar file of the generation unit. * Has only effect if packaging is "jar". - * - * @parameter */ + @Parameter private String jarFile; /** @@ -290,9 +277,8 @@ public class TorqueGeneratorMojo extends * <li> * none: The generated files are not used in the maven build. * </li> - * - * @parameter */ + @Parameter private String defaultOutputDirUsage = "compile"; /** @@ -325,35 +311,31 @@ public class TorqueGeneratorMojo extends * none: The generated files are not used in the maven build. * </li> * Default is to map the key "modifiable" to compile - * - * @parameter */ + @Parameter private Map<String, String> outputDirUsageMap = new HashMap<>(); /** * The config directory of the project overriding the settings. * If set, the settings of this directory are used as "child" * and the "normal" settings are used as "parent". - * - * @parameter */ + @Parameter private File overrideConfigDir; /** * The config package of the project overriding the settings. * If set, the settings of this directory are used as "child" * and the "normal" settings are used as "parent". - * - * @parameter */ + @Parameter private String overrideConfigPackage; /** * The Loglevel to use in the generation process. Must be one of * trace, debug, info, warn or error. - * - * @parameter */ + @Parameter private String loglevel; /** @@ -361,25 +343,22 @@ public class TorqueGeneratorMojo extends * if one of the source files changes, * false if it should always run irrespective of changes * in the source files. - * - * @parameter */ - private boolean runOnlyOnSourceChange = false; + @Parameter(defaultValue="false") + private boolean runOnlyOnSourceChange; /** * Whether to add debug information to the output. - * - * @parameter */ - private boolean addDebuggingInfoToOutput = false; + @Parameter(defaultValue="false") + private boolean addDebuggingInfoToOutput; /** * Additional options which can be added to the generation process. * This overrides both the options set in the templates * and the options in optionsFile. - * - * @parameter */ + @Parameter private Map<String, String> options; /** @@ -387,9 +366,8 @@ public class TorqueGeneratorMojo extends * to the generation process. * This overrides the options set in the templates, but not the * options set by the parameter <code>options</code>. - * - * @parameter */ + @Parameter private File optionsFile; /** @@ -399,18 +377,15 @@ public class TorqueGeneratorMojo extends * maven pom is used. * If that is also not set, the generator default is used * (which is the platform default encoding). - * - * @parameter */ + @Parameter private String defaultOutputEncoding; /** * The Maven project this plugin runs in. * - * @parameter property="${project}" - * @required - * @readonly */ + @Parameter( defaultValue = "${project}", required = true, readonly = true ) private MavenProject project; /** --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org For additional commands, e-mail: torque-dev-h...@db.apache.org