From 85107479c032e250ec212915e7693758c30f7f1d Mon Sep 17 00:00:00 2001 From: Emmanuel Venisse Date: Mon, 5 Jul 2004 10:54:50 +0000 Subject: [PATCH] Initial version of pom plugin git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162852 13f79535-47bb-0310-9956-ffa450edef68 --- maven-plugins/maven-pom-plugin/.cvsignore | 7 +++ maven-plugins/maven-pom-plugin/pom.xml | 25 ++++++++ .../maven/plugin/pom/PomDeployMojo.java | 62 +++++++++++++++++++ .../maven/plugin/pom/PomInstallMojo.java | 61 ++++++++++++++++++ 4 files changed, 155 insertions(+) create mode 100644 maven-plugins/maven-pom-plugin/.cvsignore create mode 100644 maven-plugins/maven-pom-plugin/pom.xml create mode 100644 maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomDeployMojo.java create mode 100644 maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomInstallMojo.java diff --git a/maven-plugins/maven-pom-plugin/.cvsignore b/maven-plugins/maven-pom-plugin/.cvsignore new file mode 100644 index 0000000000..98970fed73 --- /dev/null +++ b/maven-plugins/maven-pom-plugin/.cvsignore @@ -0,0 +1,7 @@ +*~ +*.log +target +.classpath +.project +*.ipr +*.iws diff --git a/maven-plugins/maven-pom-plugin/pom.xml b/maven-plugins/maven-pom-plugin/pom.xml new file mode 100644 index 0000000000..ee820a9efc --- /dev/null +++ b/maven-plugins/maven-pom-plugin/pom.xml @@ -0,0 +1,25 @@ + + + + + maven + maven-plugin-parent + 2.0-SNAPSHOT + + maven + maven-pom-plugin + plugin + Maven POM Plugin + 1.0-SNAPSHOT + org.apache.maven.plugin.pom + + + + maven + maven-core + 2.0-SNAPSHOT + + + + + diff --git a/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomDeployMojo.java b/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomDeployMojo.java new file mode 100644 index 0000000000..fcfb8af3af --- /dev/null +++ b/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomDeployMojo.java @@ -0,0 +1,62 @@ +package org.apache.maven.plugin.jar; + +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed 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.AbstractPlugin; +import org.apache.maven.plugin.PluginExecutionRequest; +import org.apache.maven.plugin.PluginExecutionResponse; +import org.apache.maven.project.MavenProject; +import org.apache.maven.artifact.installer.ArtifactInstaller; +import org.apache.maven.artifact.deployer.ArtifactDeployer; +import org.codehaus.plexus.util.FileUtils; + +import java.io.File; + +/** + * @goal deploy + * + * @description deploys a pom to remote repository + * + * @parameter + * name="project" + * type="org.apache.maven.project.MavenProject" + * required="true" + * validator="" + * expression="#project" + * description="" + * + * @parameter + * name="deployer" + * type="org.apache.maven.artifact.deployer.ArtifactDeployer" + * required="true" + * validator="" + * expression="#component.org.apache.maven.artifact.deployer.ArtifactDeployer" + * description="" + */ +public class PomDeployMojo + extends AbstractPlugin +{ + public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) + throws Exception + { + MavenProject project = (MavenProject) request.getParameter( "project" ); + + ArtifactDeployer artifactDeployer = (ArtifactDeployer) request.getParameter( "deployer" ); + + artifactDeployer.deploy( project.getFile(), "pom", project ); + } +} diff --git a/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomInstallMojo.java b/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomInstallMojo.java new file mode 100644 index 0000000000..c216448063 --- /dev/null +++ b/maven-plugins/maven-pom-plugin/src/main/java/org/apache/maven/plugin/pom/PomInstallMojo.java @@ -0,0 +1,61 @@ +package org.apache.maven.plugin.jar; + +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed 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.AbstractPlugin; +import org.apache.maven.plugin.PluginExecutionRequest; +import org.apache.maven.plugin.PluginExecutionResponse; +import org.apache.maven.project.MavenProject; +import org.apache.maven.artifact.installer.ArtifactInstaller; +import org.codehaus.plexus.util.FileUtils; + +import java.io.File; + +/** + * @goal install + * + * @description install a jar in local repository + * + * @parameter + * name="project" + * type="org.apache.maven.project.MavenProject" + * required="true" + * validator="" + * expression="#project" + * description="" + * + * @parameter + * name="installer" + * type="org.apache.maven.artifact.installer.ArtifactInstaller" + * required="true" + * validator="" + * expression="#component.org.apache.maven.artifact.installer.ArtifactInstaller" + * description="" + */ +public class PomInstallMojo + extends AbstractPlugin +{ + public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) + throws Exception + { + MavenProject project = (MavenProject) request.getParameter( "project" ); + + ArtifactInstaller artifactInstaller = (ArtifactInstaller) request.getParameter( "installer" ); + + artifactInstaller.install( project.getFile(), "pom", project ); + } +}