From 743d57b25337dc1e0b5dcfc7dce63b15a4433f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Mon, 25 Sep 2017 23:41:44 +0200 Subject: [PATCH] switched Maven plugin from javadoc annotations to Java5 annotations --- maven-hawtjni-plugin/pom.xml | 52 +++++++---- .../fusesource/hawtjni/maven/BuildMojo.java | 92 ++++++------------- .../hawtjni/maven/GenerateMojo.java | 59 +++++------- .../hawtjni/maven/PackageJarMojo.java | 34 +++---- .../hawtjni/maven/PackageSourceMojo.java | 31 +++---- pom.xml | 5 - 6 files changed, 109 insertions(+), 164 deletions(-) diff --git a/maven-hawtjni-plugin/pom.xml b/maven-hawtjni-plugin/pom.xml index e544a67f..de519157 100644 --- a/maven-hawtjni-plugin/pom.xml +++ b/maven-hawtjni-plugin/pom.xml @@ -116,39 +116,53 @@ - + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.5 + provided + + + + + + org.apache.maven.plugins + maven-plugin-plugin + 3.5 + + + - org.codehaus.plexus - plexus-maven-plugin - 1.3.8 + org.apache.maven.plugins + maven-plugin-plugin + default-descriptor + process-classes + + + + help-goal - descriptor + helpmojo - + + + + + org.apache.maven.plugins - maven-javadoc-plugin - - - - org.apache.maven.plugin-tools - maven-plugin-tools-javadoc - 3.5 - - - + maven-plugin-plugin - - - + diff --git a/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/BuildMojo.java b/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/BuildMojo.java index cf0e1764..e0ca5b7e 100644 --- a/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/BuildMojo.java +++ b/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/BuildMojo.java @@ -30,6 +30,10 @@ import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +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.codehaus.plexus.archiver.UnArchiver; import org.codehaus.plexus.archiver.manager.ArchiverManager; @@ -44,76 +48,56 @@ * to the test resource path so that unit tests can load * the freshly built JNI library. * - * @goal build - * @phase generate-test-resources * @author Hiram Chirino */ +@Mojo(name = "build", defaultPhase = LifecyclePhase.GENERATE_TEST_RESOURCES) public class BuildMojo extends AbstractMojo { /** * The maven project. - * - * @parameter expression="${project}" - * @required - * @readonly */ + @Parameter(defaultValue = "${project}", readonly = true) protected MavenProject project; /** * Remote repositories - * - * @parameter expression="${project.remoteArtifactRepositories}" - * @required - * @readonly */ + @Parameter(defaultValue = "${project.remoteArtifactRepositories}", readonly = true) protected List remoteArtifactRepositories; /** * Local maven repository. - * - * @parameter expression="${localRepository}" - * @required - * @readonly */ + @Parameter(defaultValue = "${localRepository}", readonly = true) protected ArtifactRepository localRepository; /** * Artifact factory, needed to download the package source file - * - * @component role="org.apache.maven.artifact.factory.ArtifactFactory" - * @required - * @readonly */ + @Component protected ArtifactFactory artifactFactory; /** * Artifact resolver, needed to download the package source file - * - * @component role="org.apache.maven.artifact.resolver.ArtifactResolver" - * @required - * @readonly */ + @Component protected ArtifactResolver artifactResolver; /** - * @component - * @required - * @readonly */ + @Component private ArchiverManager archiverManager; /** * The base name of the library, used to determine generated file names. - * - * @parameter default-value="${project.artifactId}" */ + @Parameter(defaultValue = "${project.artifactId}") private String name; /** * Where the unpacked build package is located. - * - * @parameter default-value="${project.build.directory}/generated-sources/hawtjni/native-package" */ + @Parameter(defaultValue = "${project.build.directory}/generated-sources/hawtjni/native-package") private File packageDirectory; /** @@ -122,121 +106,105 @@ public class BuildMojo extends AbstractMojo { * * The library will placed under the META-INF/native/${platform} directory that the HawtJNI * Library uses to find JNI libraries as classpath resources. - * - * @parameter default-value="${project.build.directory}/generated-sources/hawtjni/lib" */ + @Parameter(defaultValue = "${project.build.directory}/generated-sources/hawtjni/lib") private File libDirectory; /** * The directory where the build will be produced. It creates a native-build and native-dist directory * under the specified directory. - * - * @parameter default-value="${project.build.directory}" */ + @Parameter(defaultValue = "${project.build.directory}") private File buildDirectory; /** * Should we skip executing the autogen.sh file. - * - * @parameter default-value="${skip-autogen}" */ + @Parameter(defaultValue = "${skip-autogen}") private boolean skipAutogen; /** * Should we force executing the autogen.sh file. - * - * @parameter default-value="${force-autogen}" */ + @Parameter(defaultValue = "${force-autogen}") private boolean forceAutogen; /** * Extra arguments you want to pass to the autogen.sh command. - * - * @parameter */ + @Parameter private List autogenArgs; /** * Should we skip executing the configure command. - * - * @parameter default-value="${skip-configure}" */ + @Parameter(defaultValue = "${skip-configure}") private boolean skipConfigure; /** * Should we force executing the configure command. - * - * @parameter default-value="${force-configure}" */ + @Parameter(defaultValue = "${force-configure}") private boolean forceConfigure; /** * Should we display all the native build output? - * - * @parameter default-value="${hawtjni-verbose}" */ + @Parameter(defaultValue = "${hawtjni-verbose}") private boolean verbose; /** * Extra arguments you want to pass to the configure command. - * - * @parameter */ + @Parameter private List configureArgs; /** * The platform identifier of this build. If not specified, * it will be automatically detected. - * - * @parameter */ + @Parameter private String platform; /** * The classifier of the package archive that will be created. - * - * @parameter default-value="native-src" */ + @Parameter(defaultValue = "native-src") private String sourceClassifier; /** * If the source build could not be fully generated, perhaps the autotools * were not available on this platform, should we attempt to download * a previously deployed source package and build that? - * - * @parameter default-value="true" */ + @Parameter(defaultValue = "true") private boolean downloadSourcePackage = true; /** * The dependency to download to get the native sources. - * - * @parameter */ + @Parameter private Dependency nativeSrcDependency; /** * URL to where we can down the source package - * - * @parameter default-value="${native-src-url}" */ + @Parameter(defaultValue = "${native-src-url}") private String nativeSrcUrl; /** * The build tool to use on Windows systems. Set * to 'msbuild', 'vcbuild', or 'detect' - * - * @parameter default-value="detect" */ + @Parameter(defaultValue = "detect") private String windowsBuildTool; /** * The name of the msbuild/vcbuild project to use. * Defaults to 'vs2010' for 'msbuild' * and 'vs2008' for 'vcbuild'. - * - * @parameter */ + @Parameter private String windowsProjectName; private final CLI cli = new CLI(); @@ -276,7 +244,7 @@ private void vsBasedBuild(File buildDir) throws CommandLineException, MojoExecut } else if( "windows64".equals(libPlatform) ) { platform = "x64"; } else { - throw new MojoExecutionException("Usupported platform: "+libPlatform); + throw new MojoExecutionException("Unsupported platform: "+libPlatform); } boolean useMSBuild = false; diff --git a/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/GenerateMojo.java b/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/GenerateMojo.java index 55901e72..d26ef59d 100644 --- a/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/GenerateMojo.java +++ b/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/GenerateMojo.java @@ -29,6 +29,9 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.AbstractMojo; 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.codehaus.plexus.interpolation.InterpolatorFilterReader; import org.codehaus.plexus.interpolation.MapBasedValueSource; @@ -44,138 +47,118 @@ * build a JNI library for any HawtJNI annotated * classes in your maven project. * - * @goal generate - * @phase process-classes * @author Hiram Chirino */ +@Mojo(name = "generate", defaultPhase = LifecyclePhase.PROCESS_CLASSES) public class GenerateMojo extends AbstractMojo { /** * The maven project. - * - * @parameter expression="${project}" - * @required - * @readonly */ + @Parameter(defaultValue = "${project}", readonly = true) protected MavenProject project; /** * The directory where the native source files are located. - * - * @parameter */ + @Parameter private File nativeSourceDirectory; /** * The directory where the generated native source files are located. - * - * @parameter default-value="${project.build.directory}/generated-sources/hawtjni/native-src" */ + @Parameter(defaultValue = "${project.build.directory}/generated-sources/hawtjni/native-src") private File generatedNativeSourceDirectory; /** * The base name of the library, used to determine generated file names. - * - * @parameter default-value="${project.artifactId}" */ + @Parameter(defaultValue = "${project.artifactId}") private String name; /** * The copyright header template that will be added to the generated source files. * Use the '%END_YEAR%' token to have it replaced with the current year. - * - * @parameter default-value="" */ + @Parameter(defaultValue = "") private String copyright; /** * Restrict looking for JNI classes to the specified package. - * - * @parameter */ + @Parameter private List packages = new ArrayList(); /** * The directory where the java classes files are located. - * - * @parameter default-value="${project.build.outputDirectory}" */ + @Parameter(defaultValue = "${project.build.outputDirectory}") private File classesDirectory; /** * The directory where the generated build package is located.. - * - * @parameter default-value="${project.build.directory}/generated-sources/hawtjni/native-package" */ + @Parameter(defaultValue = "${project.build.directory}/generated-sources/hawtjni/native-package") private File packageDirectory; /** * The list of additional files to be included in the package will be * placed. - * - * @parameter default-value="${basedir}/src/main/native-package" */ + @Parameter(defaultValue = "${basedir}/src/main/native-package") private File customPackageDirectory; /** * The text encoding of the files. - * - * @parameter default-value="UTF-8" */ + @Parameter(defaultValue = "UTF-8") private String encoding; /** * Should we skip executing the autogen.sh file. - * - * @parameter default-value="${skip-autogen}" */ + @Parameter(defaultValue = "${skip-autogen}") private boolean skipAutogen; /** * Should we force executing the autogen.sh file. - * - * @parameter default-value="${force-autogen}" */ + @Parameter(defaultValue = "${force-autogen}") private boolean forceAutogen; /** * Should we display all the native build output? - * - * @parameter default-value="${hawtjni-verbose}" */ + @Parameter(defaultValue = "${hawtjni-verbose}") private boolean verbose; /** * Extra arguments you want to pass to the autogen.sh command. - * - * @parameter */ + @Parameter private List autogenArgs; /** * Set this value to false to disable the callback support in HawtJNI. * Disabling callback support can substantially reduce the size * of the generated native library. - * - * @parameter default-value="true" */ + @Parameter(defaultValue = "true") private boolean callbacks; /** * The build tool to use on Windows systems. Set * to 'msbuild', 'vcbuild', or 'detect' - * - * @parameter default-value="detect" */ + @Parameter(defaultValue = "detect") private String windowsBuildTool; /** * The name of the msbuild/vcbuild project to use. * Defaults to 'vs2010' for 'msbuild' * and 'vs2008' for 'vcbuild'. - * - * @parameter */ + @Parameter private String windowsProjectName; private File targetSrcDir; diff --git a/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/PackageJarMojo.java b/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/PackageJarMojo.java index 4df128b0..d279b61e 100644 --- a/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/PackageJarMojo.java +++ b/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/PackageJarMojo.java @@ -21,6 +21,10 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +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.maven.project.MavenProjectHelper; import org.codehaus.plexus.archiver.jar.JarArchiver; @@ -37,40 +41,31 @@ * This platform specific jar is attached with a classifier which matches the * current platform. * - * @goal package-jar - * @phase prepare-package * @author Hiram Chirino */ +@Mojo(name = "package-jar", defaultPhase = LifecyclePhase.PREPARE_PACKAGE) public class PackageJarMojo extends AbstractMojo { /** * The maven project. - * - * @parameter expression="${project}" - * @required - * @readonly */ + @Parameter(defaultValue = "${project}", readonly = true) protected MavenProject project; /** * The base name of the library, used to determine generated file names. - * - * @parameter default-value="${project.artifactId}" */ + @Parameter(defaultValue = "${project.artifactId}") private String name; /** - * @component - * @required - * @readonly */ + @Component private ArchiverManager archiverManager; /** - * @component - * @required - * @readonly */ + @Component private MavenProjectHelper projectHelper; /** @@ -81,10 +76,8 @@ public class PackageJarMojo extends AbstractMojo { * The library will placed under the META-INF/native/${platform} directory * that the HawtJNI Library uses to find JNI libraries as classpath * resources. - * - * @parameter - * default-value="${project.build.directory}/generated-sources/hawtjni/lib" */ + @Parameter(defaultValue = "${project.build.directory}/generated-sources/hawtjni/lib") private File libDirectory; /** @@ -93,22 +86,21 @@ public class PackageJarMojo extends AbstractMojo { * * @parameter */ + @Parameter private String platform; /** * Should a classifier of the native jar be set * to match the platform? - * - * @parameter default-value="true" */ + @Parameter(defaultValue = "true") private boolean classified; /** * The osgi platforms that the library match for. Example value: * osname=MacOS;processor=x86-64 - * - * @parameter */ + @Parameter private List osgiPlatforms; public void execute() throws MojoExecutionException { diff --git a/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/PackageSourceMojo.java b/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/PackageSourceMojo.java index 6c89f2f7..d2637839 100644 --- a/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/PackageSourceMojo.java +++ b/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/PackageSourceMojo.java @@ -20,6 +20,10 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +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.maven.project.MavenProjectHelper; import org.codehaus.plexus.archiver.Archiver; @@ -30,54 +34,43 @@ * module and attaches it to the build so that it can get * deployed. * - * @goal package-source - * @phase package * @author Hiram Chirino */ +@Mojo(name = "package-source", defaultPhase = LifecyclePhase.PACKAGE) public class PackageSourceMojo extends AbstractMojo { /** * The maven project. - * - * @parameter expression="${project}" - * @required - * @readonly */ + @Parameter(defaultValue = "${project}", readonly = true) protected MavenProject project; /** - * @component - * @required - * @readonly */ + @Component private ArchiverManager archiverManager; /** - * @component - * @required - * @readonly */ + @Component private MavenProjectHelper projectHelper; /** * The directory where the generated native files are located.. - * - * @parameter default-value="${project.build.directory}/generated-sources/hawtjni/native-package" */ + @Parameter(defaultValue = "${project.build.directory}/generated-sources/hawtjni/native-package") private File packageDirectory; /** * The classifier of the package archive that will be created. - * - * @parameter default-value="native-src" */ + @Parameter(defaultValue = "native-src") private String sourceClassifier; /** * Should we skip executing the autogen.sh file. - * - * @parameter default-value="${skip-autogen}" */ + @Parameter(defaultValue = "${skip-autogen}") private boolean skipAutogen; @@ -96,7 +89,7 @@ public void execute() throws MojoExecutionException { getLog().info(""); getLog().warn("Will NOT package the native sources to: "+packageFile); getLog().info(" Native source build directory did not contain a 'configure' script."); - getLog().info(" To ignore this warnning and package it up anyways configure the plugin with: true"); + getLog().info(" To ignore this warning and package it up anyways, configure the plugin with: true"); getLog().info(""); return; } diff --git a/pom.xml b/pom.xml index 4249a681..e84f5b32 100644 --- a/pom.xml +++ b/pom.xml @@ -216,11 +216,6 @@ surefire-report-maven-plugin 2.20 - - org.apache.maven.plugins - maven-plugin-plugin - 3.5 -