mirror of https://github.com/apache/maven.git
*** empty log message ***
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162928 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
601320d28f
commit
d83868e9cd
|
@ -7,11 +7,11 @@
|
||||||
<artifactId>maven-plugin-parent</artifactId>
|
<artifactId>maven-plugin-parent</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>maven-clean-plugin</groupId>
|
<groupId>maven</groupId>
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
<type>plugin</type>
|
<type>plugin</type>
|
||||||
<name>Maven Clean Plugin</name>
|
<name>Maven Clean Plugin</name>
|
||||||
<currentVersion>1.0-SNAPSHOT</currentVersion>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<inceptionYear>2001</inceptionYear>
|
<inceptionYear>2001</inceptionYear>
|
||||||
<package>org.apache.maven.plugin.clean</package>
|
<package>org.apache.maven.plugin.clean</package>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -15,6 +15,11 @@
|
||||||
<inceptionYear>2001</inceptionYear>
|
<inceptionYear>2001</inceptionYear>
|
||||||
<package>org.apache.maven</package>
|
<package>org.apache.maven</package>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>plexus</groupId>
|
||||||
|
<artifactId>plexus</artifactId>
|
||||||
|
<version>0.16-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>plexus</groupId>
|
<groupId>plexus</groupId>
|
||||||
<artifactId>plexus-compiler-api</artifactId>
|
<artifactId>plexus-compiler-api</artifactId>
|
||||||
|
|
|
@ -20,5 +20,20 @@
|
||||||
<artifactId>maven-core</artifactId>
|
<artifactId>maven-core</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>maven</groupId>
|
||||||
|
<artifactId>maven-model</artifactId>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>maven</groupId>
|
||||||
|
<artifactId>maven-artifact</artifactId>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>maven</groupId>
|
||||||
|
<artifactId>wagon-api</artifactId>
|
||||||
|
<version>1.0-alpha-1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -16,62 +16,61 @@ package org.apache.maven.plugin.install;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.Artifact;
|
||||||
|
import org.apache.maven.artifact.DefaultArtifact;
|
||||||
|
import org.apache.maven.artifact.installer.ArtifactInstaller;
|
||||||
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.plugin.AbstractPlugin;
|
import org.apache.maven.plugin.AbstractPlugin;
|
||||||
import org.apache.maven.plugin.PluginExecutionRequest;
|
import org.apache.maven.plugin.PluginExecutionRequest;
|
||||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
import org.apache.maven.plugin.PluginExecutionResponse;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.Maven;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @goal install
|
* @goal install
|
||||||
*
|
*
|
||||||
* @description installs project's main artifact in local repository
|
* @description installs project's main artifact in local repository
|
||||||
*
|
*
|
||||||
* @parameter
|
* @parameter name="project"
|
||||||
* name="project"
|
* type="org.apache.maven.project.MavenProject"
|
||||||
* type="org.apache.maven.project.MavenProject"
|
* required="true"
|
||||||
* required="true"
|
* validator=""
|
||||||
* validator=""
|
* expression="#project"
|
||||||
* expression="#project"
|
* description=""
|
||||||
* description=""
|
|
||||||
*
|
*
|
||||||
* @parameter
|
* @parameter name="installer"
|
||||||
* name="maven"
|
* type="org.apache.maven.artifact.installer.ArtifactInstaller"
|
||||||
* type="org.apache.maven.Maven"
|
* required="true"
|
||||||
* required="true"
|
* validator=""
|
||||||
* validator=""
|
* expression="#component.org.apache.maven.artifact.installer.ArtifactInstaller"
|
||||||
* expression="#component.org.apache.maven.Maven"
|
* description=""
|
||||||
* description=""""
|
*
|
||||||
|
* @parameter name="localRepository"
|
||||||
|
* type="org.apache.maven.artifact.repository.ArtifactRepository"
|
||||||
|
* required="true"
|
||||||
|
* validator=""
|
||||||
|
* expression="#localRepository"
|
||||||
|
* description=""
|
||||||
|
*
|
||||||
|
* @prereq build
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
*/
|
||||||
public class InstallMojo
|
public class InstallMojo
|
||||||
extends AbstractPlugin
|
extends AbstractPlugin
|
||||||
{
|
{
|
||||||
|
|
||||||
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
MavenProject project = (MavenProject) request.getParameter( "project" );
|
MavenProject project = (MavenProject) request.getParameter( "project" );
|
||||||
|
|
||||||
String type = project.getType();
|
ArtifactInstaller artifactInstaller = (ArtifactInstaller) request.getParameter( "installer" );
|
||||||
|
|
||||||
Maven maven = ( Maven ) request.getParameter( "maven" );
|
ArtifactRepository localRepository = (ArtifactRepository) request.getParameter( "localRepository" );
|
||||||
|
|
||||||
String goal = type + ":install";
|
Artifact artifact = new DefaultArtifact( project.getGroupId(),
|
||||||
|
project.getArtifactId(),
|
||||||
List goals = new ArrayList( 1 );
|
project.getVersion(),
|
||||||
|
project.getType() );
|
||||||
goals.add( goal );
|
|
||||||
|
|
||||||
maven.execute( project, goals );
|
|
||||||
|
|
||||||
|
artifactInstaller.install( project.getBuild().getDirectory(), artifact, localRepository );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,11 @@
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<package>org.apache.maven.plugin.jar</package>
|
<package>org.apache.maven.plugin.jar</package>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>plexus</groupId>
|
||||||
|
<artifactId>plexus</artifactId>
|
||||||
|
<version>0.16-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>maven</groupId>
|
<groupId>maven</groupId>
|
||||||
<artifactId>maven-artifact</artifactId>
|
<artifactId>maven-artifact</artifactId>
|
||||||
|
@ -24,5 +29,15 @@
|
||||||
<artifactId>maven-core</artifactId>
|
<artifactId>maven-core</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>maven</groupId>
|
||||||
|
<artifactId>maven-model</artifactId>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>maven</groupId>
|
||||||
|
<artifactId>wagon-api</artifactId>
|
||||||
|
<version>1.0-alpha-1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -17,24 +17,21 @@ package org.apache.maven.plugin.jar;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.AbstractPlugin;
|
||||||
|
import org.codehaus.plexus.util.DirectoryScanner;
|
||||||
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.jar.Attributes;
|
import java.util.jar.Attributes;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarOutputStream;
|
import java.util.jar.JarOutputStream;
|
||||||
import java.util.jar.Manifest;
|
import java.util.jar.Manifest;
|
||||||
|
|
||||||
import org.apache.maven.artifact.MavenArtifact;
|
|
||||||
import org.apache.maven.plugin.AbstractPlugin;
|
|
||||||
import org.apache.maven.project.MavenProject;
|
|
||||||
import org.codehaus.plexus.util.DirectoryScanner;
|
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for tasks that build archives in JAR file format.
|
* Base class for tasks that build archives in JAR file format.
|
||||||
*
|
*
|
||||||
|
@ -52,9 +49,12 @@ public abstract class AbstractJarMojo
|
||||||
* @param tag the property tag to look for; for example "jar.bundle"
|
* @param tag the property tag to look for; for example "jar.bundle"
|
||||||
* @param pathTag the property tag that specifies the target path; for example, jar.target.path
|
* @param pathTag the property tag that specifies the target path; for example, jar.target.path
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
protected void addTaggedDependencies(Map includes, MavenProject project, String tag, String pathTag) {
|
protected void addTaggedDependencies(Map includes, MavenProject project, String tag, String pathTag) {
|
||||||
addTaggedDependencies(includes, "", project, tag, pathTag);
|
addTaggedDependencies(includes, "", project, tag, pathTag);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add artifacts from tagged dependencies to the archive. For example, the definition:
|
* Add artifacts from tagged dependencies to the archive. For example, the definition:
|
||||||
|
@ -77,9 +77,11 @@ public abstract class AbstractJarMojo
|
||||||
* @param tag the property tag to look for; for example "jar.bundle"
|
* @param tag the property tag to look for; for example "jar.bundle"
|
||||||
* @param pathTag the property tag that specifies the target path; for example, jar.target.path
|
* @param pathTag the property tag that specifies the target path; for example, jar.target.path
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
protected void addTaggedDependencies(Map includes, String prefix, MavenProject project, String tag, String pathTag) {
|
protected void addTaggedDependencies(Map includes, String prefix, MavenProject project, String tag, String pathTag) {
|
||||||
for (Iterator i = project.getArtifacts().iterator(); i.hasNext();) {
|
for (Iterator i = project.getArtifacts().iterator(); i.hasNext();) {
|
||||||
MavenArtifact artifact = (MavenArtifact) i.next();
|
Artifact artifact = (Artifact) i.next();
|
||||||
Properties properties = artifact.getDependency().getProperties();
|
Properties properties = artifact.getDependency().getProperties();
|
||||||
if (Boolean.valueOf(properties.getProperty(tag)).booleanValue()) {
|
if (Boolean.valueOf(properties.getProperty(tag)).booleanValue()) {
|
||||||
File file = new File(artifact.getPath());
|
File file = new File(artifact.getPath());
|
||||||
|
@ -88,6 +90,7 @@ public abstract class AbstractJarMojo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add all files in the specified directory to the archive.
|
* Add all files in the specified directory to the archive.
|
||||||
|
@ -95,31 +98,33 @@ public abstract class AbstractJarMojo
|
||||||
* @param includes a map <String, File> of items to be include in the outpur
|
* @param includes a map <String, File> of items to be include in the outpur
|
||||||
* @param baseDir the directory to add
|
* @param baseDir the directory to add
|
||||||
*/
|
*/
|
||||||
protected void addDirectory(Map includes, File baseDir) throws IOException {
|
protected void addDirectory( Map includes, File baseDir ) throws IOException
|
||||||
addDirectory(includes, "", baseDir);
|
{
|
||||||
|
addDirectory( includes, "", baseDir );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add all files in the specified directory to the archive.
|
* Add all files in the specified directory to the archive.
|
||||||
*
|
*
|
||||||
* @param includes a map <String, File> of items to be include in the outpur
|
* @param includes a map <String, File> of items to be include in the outpur
|
||||||
* @param prefix value to be added to the front of jar entry names
|
* @param prefix value to be added to the front of jar entry names
|
||||||
* @param baseDir the directory to add
|
* @param baseDir the directory to add
|
||||||
*/
|
*/
|
||||||
protected void addDirectory(Map includes, String prefix, File baseDir) throws IOException {
|
protected void addDirectory( Map includes, String prefix, File baseDir ) throws IOException
|
||||||
|
{
|
||||||
addDirectory( includes, null, null, prefix, baseDir );
|
addDirectory( includes, null, null, prefix, baseDir );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add all files in the specified directory to the archive.
|
* Add all files in the specified directory to the archive.
|
||||||
*
|
*
|
||||||
* @param includes a map <String, File> of items to be include in the outpur
|
* @param includes a map <String, File> of items to be include in the outpur
|
||||||
* @param includesPattern Sets the list of include patterns to use
|
* @param includesPattern Sets the list of include patterns to use
|
||||||
* @param excludesPattern Sets the list of exclude patterns to use
|
* @param excludesPattern Sets the list of exclude patterns to use
|
||||||
* @param prefix value to be added to the front of jar entry names
|
* @param prefix value to be added to the front of jar entry names
|
||||||
* @param baseDir the directory to add
|
* @param baseDir the directory to add
|
||||||
*/
|
*/
|
||||||
protected void addDirectory(Map includes, String includesPattern, String excludesPattern, String prefix, File baseDir)
|
protected void addDirectory( Map includes, String includesPattern, String excludesPattern, String prefix, File baseDir )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
if ( !baseDir.exists() )
|
if ( !baseDir.exists() )
|
||||||
|
@ -128,7 +133,7 @@ public abstract class AbstractJarMojo
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryScanner scanner = new DirectoryScanner();
|
DirectoryScanner scanner = new DirectoryScanner();
|
||||||
scanner.setBasedir(baseDir);
|
scanner.setBasedir( baseDir );
|
||||||
if ( includesPattern != null )
|
if ( includesPattern != null )
|
||||||
{
|
{
|
||||||
scanner.setIncludes( StringUtils.split( includesPattern, "," ) );
|
scanner.setIncludes( StringUtils.split( includesPattern, "," ) );
|
||||||
|
@ -140,10 +145,11 @@ public abstract class AbstractJarMojo
|
||||||
}
|
}
|
||||||
scanner.scan();
|
scanner.scan();
|
||||||
String[] files = scanner.getIncludedFiles();
|
String[] files = scanner.getIncludedFiles();
|
||||||
for (int i = 0; i < files.length; i++) {
|
for ( int i = 0; i < files.length; i++ )
|
||||||
|
{
|
||||||
String file = files[i];
|
String file = files[i];
|
||||||
file = file.replace('\\', '/'); // todo shouldn't the scanner return platform independent names?
|
file = file.replace( '\\', '/' ); // todo shouldn't the scanner return platform independent names?
|
||||||
includes.put(prefix + file, new File(baseDir, file));
|
includes.put( prefix + file, new File( baseDir, file ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,16 +160,20 @@ public abstract class AbstractJarMojo
|
||||||
* @param includes a Map<String, File>of items to include; the key is the jar entry name
|
* @param includes a Map<String, File>of items to include; the key is the jar entry name
|
||||||
* @throws IOException if there is a problem writing the archive or reading the sources
|
* @throws IOException if there is a problem writing the archive or reading the sources
|
||||||
*/
|
*/
|
||||||
protected void createJar(File jarFile, Map includes) throws IOException {
|
protected void createJar( File jarFile, Map includes ) throws IOException
|
||||||
|
{
|
||||||
File parentJarFile = jarFile.getParentFile();
|
File parentJarFile = jarFile.getParentFile();
|
||||||
if ( !parentJarFile.exists() )
|
if ( !parentJarFile.exists() )
|
||||||
{
|
{
|
||||||
parentJarFile.mkdirs();
|
parentJarFile.mkdirs();
|
||||||
}
|
}
|
||||||
JarOutputStream jos = createJar(jarFile, createManifest());
|
JarOutputStream jos = createJar( jarFile, createManifest() );
|
||||||
try {
|
try
|
||||||
addEntries(jos, includes);
|
{
|
||||||
} finally {
|
addEntries( jos, includes );
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
jos.close();
|
jos.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,11 +183,12 @@ public abstract class AbstractJarMojo
|
||||||
*
|
*
|
||||||
* @return a default manifest; the Manifest-Version and Created-By attributes are initialized
|
* @return a default manifest; the Manifest-Version and Created-By attributes are initialized
|
||||||
*/
|
*/
|
||||||
protected Manifest createManifest() {
|
protected Manifest createManifest()
|
||||||
|
{
|
||||||
Manifest mf = new Manifest();
|
Manifest mf = new Manifest();
|
||||||
Attributes attrs = mf.getMainAttributes();
|
Attributes attrs = mf.getMainAttributes();
|
||||||
attrs.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
|
attrs.putValue( Attributes.Name.MANIFEST_VERSION.toString(), "1.0" );
|
||||||
attrs.putValue("Created-By", "2.0 (Apache Maven)");
|
attrs.putValue( "Created-By", "2.0 (Apache Maven)" );
|
||||||
return mf;
|
return mf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,16 +200,23 @@ public abstract class AbstractJarMojo
|
||||||
* @return a JarOutputStream that can be used to write to that file
|
* @return a JarOutputStream that can be used to write to that file
|
||||||
* @throws IOException if there was a problem opening the file
|
* @throws IOException if there was a problem opening the file
|
||||||
*/
|
*/
|
||||||
protected JarOutputStream createJar(File jarFile, Manifest mf) throws IOException {
|
protected JarOutputStream createJar( File jarFile, Manifest mf ) throws IOException
|
||||||
|
{
|
||||||
jarFile.getParentFile().mkdirs();
|
jarFile.getParentFile().mkdirs();
|
||||||
FileOutputStream fos = new FileOutputStream(jarFile);
|
FileOutputStream fos = new FileOutputStream( jarFile );
|
||||||
try {
|
try
|
||||||
return new JarOutputStream(fos, mf);
|
{
|
||||||
} catch (IOException e) {
|
return new JarOutputStream( fos, mf );
|
||||||
try {
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
fos.close();
|
fos.close();
|
||||||
jarFile.delete();
|
jarFile.delete();
|
||||||
} catch (IOException e1) {
|
}
|
||||||
|
catch ( IOException e1 )
|
||||||
|
{
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -212,12 +230,14 @@ public abstract class AbstractJarMojo
|
||||||
* @param includes a Map<String, File> of entries to add
|
* @param includes a Map<String, File> of entries to add
|
||||||
* @throws IOException if there is a problem writing the archive or reading the sources
|
* @throws IOException if there is a problem writing the archive or reading the sources
|
||||||
*/
|
*/
|
||||||
protected void addEntries(JarOutputStream jos, Map includes) throws IOException {
|
protected void addEntries( JarOutputStream jos, Map includes ) throws IOException
|
||||||
for (Iterator i = includes.entrySet().iterator(); i.hasNext();) {
|
{
|
||||||
|
for ( Iterator i = includes.entrySet().iterator(); i.hasNext(); )
|
||||||
|
{
|
||||||
Map.Entry entry = (Map.Entry) i.next();
|
Map.Entry entry = (Map.Entry) i.next();
|
||||||
String name = (String) entry.getKey();
|
String name = (String) entry.getKey();
|
||||||
File file = (File) entry.getValue();
|
File file = (File) entry.getValue();
|
||||||
addEntry(jos, name, file);
|
addEntry( jos, name, file );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,16 +249,21 @@ public abstract class AbstractJarMojo
|
||||||
* @param source the file to add
|
* @param source the file to add
|
||||||
* @throws IOException if there is a problem writing the archive or reading the sources
|
* @throws IOException if there is a problem writing the archive or reading the sources
|
||||||
*/
|
*/
|
||||||
protected void addEntry(JarOutputStream jos, String name, File source) throws IOException {
|
protected void addEntry( JarOutputStream jos, String name, File source ) throws IOException
|
||||||
FileInputStream fis = new FileInputStream(source);
|
{
|
||||||
try {
|
FileInputStream fis = new FileInputStream( source );
|
||||||
jos.putNextEntry(new JarEntry(name));
|
try
|
||||||
|
{
|
||||||
|
jos.putNextEntry( new JarEntry( name ) );
|
||||||
int count;
|
int count;
|
||||||
while ((count = fis.read(buffer)) > 0) {
|
while ( ( count = fis.read( buffer ) ) > 0 )
|
||||||
jos.write(buffer, 0, count);
|
{
|
||||||
|
jos.write( buffer, 0, count );
|
||||||
}
|
}
|
||||||
jos.closeEntry();
|
jos.closeEntry();
|
||||||
} finally {
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
fis.close();
|
fis.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,10 @@ import org.apache.maven.plugin.PluginExecutionResponse;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.artifact.installer.ArtifactInstaller;
|
import org.apache.maven.artifact.installer.ArtifactInstaller;
|
||||||
import org.apache.maven.artifact.deployer.ArtifactDeployer;
|
import org.apache.maven.artifact.deployer.ArtifactDeployer;
|
||||||
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
|
import org.apache.maven.artifact.Artifact;
|
||||||
|
import org.apache.maven.artifact.DefaultArtifact;
|
||||||
|
import org.apache.maven.repository.RepositoryUtils;
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -29,25 +33,7 @@ import java.io.File;
|
||||||
/**
|
/**
|
||||||
* @goal deploy
|
* @goal deploy
|
||||||
*
|
*
|
||||||
* @description deploys a jar to remote repository
|
* @description deploys a JAR to remote repository
|
||||||
*
|
|
||||||
* @prereq jar:jar
|
|
||||||
*
|
|
||||||
* @parameter
|
|
||||||
* name="jarName"
|
|
||||||
* type="String"
|
|
||||||
* required="true"
|
|
||||||
* validator=""
|
|
||||||
* expression="#maven.final.name"
|
|
||||||
* description=""
|
|
||||||
*
|
|
||||||
* @parameter
|
|
||||||
* name="outputDirectory"
|
|
||||||
* type="String"
|
|
||||||
* required="true"
|
|
||||||
* validator=""
|
|
||||||
* expression="#project.build.directory"
|
|
||||||
* description=""
|
|
||||||
*
|
*
|
||||||
* @parameter
|
* @parameter
|
||||||
* name="project"
|
* name="project"
|
||||||
|
@ -71,16 +57,18 @@ public class JarDeployMojo
|
||||||
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
String outputDirectory = (String) request.getParameter( "outputDirectory" );
|
|
||||||
|
|
||||||
String jarName = (String) request.getParameter( "jarName" );
|
|
||||||
|
|
||||||
File jarFile = new File( outputDirectory, jarName + ".jar" );
|
|
||||||
|
|
||||||
MavenProject project = (MavenProject) request.getParameter( "project" );
|
MavenProject project = (MavenProject) request.getParameter( "project" );
|
||||||
|
|
||||||
ArtifactDeployer artifactDeployer = (ArtifactDeployer) request.getParameter( "deployer" );
|
ArtifactDeployer artifactDeployer = (ArtifactDeployer) request.getParameter( "deployer" );
|
||||||
|
|
||||||
artifactDeployer.deploy( jarFile, "jar", project );
|
ArtifactRepository deploymentRepository =
|
||||||
|
RepositoryUtils.mavenRepositoryToWagonRepository( project.getDistributionManagement().getRepository() );
|
||||||
|
|
||||||
|
Artifact artifact = new DefaultArtifact( project.getGroupId(),
|
||||||
|
project.getArtifactId(),
|
||||||
|
project.getVersion(),
|
||||||
|
project.getType() );
|
||||||
|
|
||||||
|
artifactDeployer.deploy( project.getBuild().getDirectory(), artifact, deploymentRepository );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,53 +16,43 @@ package org.apache.maven.plugin.jar;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.Artifact;
|
||||||
|
import org.apache.maven.artifact.DefaultArtifact;
|
||||||
|
import org.apache.maven.artifact.installer.ArtifactInstaller;
|
||||||
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.plugin.AbstractPlugin;
|
import org.apache.maven.plugin.AbstractPlugin;
|
||||||
import org.apache.maven.plugin.PluginExecutionRequest;
|
import org.apache.maven.plugin.PluginExecutionRequest;
|
||||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
import org.apache.maven.plugin.PluginExecutionResponse;
|
||||||
import org.apache.maven.project.MavenProject;
|
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
|
* @goal install
|
||||||
*
|
*
|
||||||
* @description install a jar in local repository
|
* @description installs project's main artifact 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=""
|
||||||
|
*
|
||||||
|
* @parameter name="localRepository"
|
||||||
|
* type="org.apache.maven.artifact.repository.ArtifactRepository"
|
||||||
|
* required="true"
|
||||||
|
* validator=""
|
||||||
|
* expression="#localRepository"
|
||||||
|
* description=""
|
||||||
*
|
*
|
||||||
* @prereq jar:jar
|
* @prereq jar:jar
|
||||||
*
|
*
|
||||||
* @parameter
|
|
||||||
* name="jarName"
|
|
||||||
* type="String"
|
|
||||||
* required="true"
|
|
||||||
* validator=""
|
|
||||||
* expression="#maven.final.name"
|
|
||||||
* description=""
|
|
||||||
*
|
|
||||||
* @parameter
|
|
||||||
* name="outputDirectory"
|
|
||||||
* type="String"
|
|
||||||
* required="true"
|
|
||||||
* validator=""
|
|
||||||
* expression="#project.build.directory"
|
|
||||||
* description=""
|
|
||||||
*
|
|
||||||
* @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 JarInstallMojo
|
public class JarInstallMojo
|
||||||
extends AbstractPlugin
|
extends AbstractPlugin
|
||||||
|
@ -70,16 +60,17 @@ public class JarInstallMojo
|
||||||
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
String outputDirectory = (String) request.getParameter( "outputDirectory" );
|
|
||||||
|
|
||||||
String jarName = (String) request.getParameter( "jarName" );
|
|
||||||
|
|
||||||
File jarFile = new File( outputDirectory, jarName + ".jar" );
|
|
||||||
|
|
||||||
MavenProject project = (MavenProject) request.getParameter( "project" );
|
MavenProject project = (MavenProject) request.getParameter( "project" );
|
||||||
|
|
||||||
ArtifactInstaller artifactInstaller = (ArtifactInstaller) request.getParameter( "installer" );
|
ArtifactInstaller artifactInstaller = (ArtifactInstaller) request.getParameter( "installer" );
|
||||||
|
|
||||||
artifactInstaller.install( jarFile, "jar", project );
|
ArtifactRepository localRepository = (ArtifactRepository) request.getParameter( "localRepository" );
|
||||||
|
|
||||||
|
Artifact artifact = new DefaultArtifact( project.getGroupId(),
|
||||||
|
project.getArtifactId(),
|
||||||
|
project.getVersion(),
|
||||||
|
project.getType() );
|
||||||
|
|
||||||
|
artifactInstaller.install( project.getBuild().getDirectory(), artifact, localRepository );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<artifactId>maven-plugin-parent</artifactId>
|
<artifactId>maven-plugin-parent</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>maven-plugin-plugin</groupId>
|
<groupId>maven</groupId>
|
||||||
<artifactId>maven-plugin-plugin</artifactId>
|
<artifactId>maven-plugin-plugin</artifactId>
|
||||||
<type>plugin</type>
|
<type>plugin</type>
|
||||||
<name>Maven</name>
|
<name>Maven</name>
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>maven</groupId>
|
<groupId>maven</groupId>
|
||||||
<artifactId>maven-core</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -1,79 +0,0 @@
|
||||||
package org.apache.maven.plugin.plugin;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* LICENSE
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @goal deploy
|
|
||||||
*
|
|
||||||
* @description Installs a plugin into local repository
|
|
||||||
*
|
|
||||||
* @prereq plugin:plugin
|
|
||||||
*
|
|
||||||
* @parameter
|
|
||||||
* name="outputDirectory"
|
|
||||||
* type="String"
|
|
||||||
* required="true"
|
|
||||||
* validator=""
|
|
||||||
* expression="#project.build.directory"
|
|
||||||
* description=""
|
|
||||||
*
|
|
||||||
* @parameter
|
|
||||||
* name="jarName"
|
|
||||||
* type="String"
|
|
||||||
* required="true"
|
|
||||||
* validator=""
|
|
||||||
* expression="#maven.final.name"
|
|
||||||
* description=""
|
|
||||||
*
|
|
||||||
* @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=""
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
|
|
||||||
* @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class PluginDeployMojo
|
|
||||||
extends AbstractPluginMojo
|
|
||||||
{
|
|
||||||
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
File jarFile = getJarFile( request );
|
|
||||||
|
|
||||||
MavenProject project = (MavenProject) request.getParameter( "project" );
|
|
||||||
|
|
||||||
ArtifactDeployer artifactDeployer = ( ArtifactDeployer ) request.getParameter( "deployer" );
|
|
||||||
|
|
||||||
artifactDeployer.deploy( jarFile, "plugin", project );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,81 +0,0 @@
|
||||||
package org.apache.maven.plugin.plugin;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* LICENSE
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @goal install
|
|
||||||
*
|
|
||||||
* @description Installs a plugin into local repository
|
|
||||||
*
|
|
||||||
* @prereq plugin:plugin
|
|
||||||
*
|
|
||||||
* @parameter
|
|
||||||
* name="outputDirectory"
|
|
||||||
* type="String"
|
|
||||||
* required="true"
|
|
||||||
* validator=""
|
|
||||||
* expression="#project.build.directory"
|
|
||||||
* description=""
|
|
||||||
*
|
|
||||||
* @parameter
|
|
||||||
* name="jarName"
|
|
||||||
* type="String"
|
|
||||||
* required="true"
|
|
||||||
* validator=""
|
|
||||||
* expression="#maven.final.name"
|
|
||||||
* description=""
|
|
||||||
*
|
|
||||||
* @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=""
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
|
|
||||||
* @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class PluginInstallMojo
|
|
||||||
extends AbstractPluginMojo
|
|
||||||
{
|
|
||||||
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
File jarFile = getJarFile( request );
|
|
||||||
|
|
||||||
MavenProject project = (MavenProject) request.getParameter( "project" );
|
|
||||||
|
|
||||||
ArtifactInstaller artifactInstaller = (ArtifactInstaller) request.getParameter( "installer" );
|
|
||||||
|
|
||||||
System.out.println( "artifactInstaller: " + artifactInstaller );
|
|
||||||
|
|
||||||
artifactInstaller.install( jarFile, "plugin", project );
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package org.apache.maven.plugin.plugin;
|
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractPlugin;
|
|
||||||
import org.apache.maven.plugin.PluginExecutionRequest;
|
|
||||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @goal plugin
|
|
||||||
*
|
|
||||||
* @description Creates a plugin jar
|
|
||||||
*
|
|
||||||
* @prereq plugin:descriptor
|
|
||||||
*
|
|
||||||
* @prereq jar:jar
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class PluginMojo extends AbstractPlugin
|
|
||||||
{
|
|
||||||
|
|
||||||
public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) throws Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,121 +0,0 @@
|
||||||
package org.apache.maven.plugin.plugin;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractPlugin;
|
|
||||||
import org.apache.maven.plugin.PluginExecutionRequest;
|
|
||||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
|
||||||
|
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* LICENSE
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @goal setup
|
|
||||||
*
|
|
||||||
* @description Installs a plugin into the maven installation.
|
|
||||||
*
|
|
||||||
* @prereq plugin:plugin
|
|
||||||
*
|
|
||||||
* @parameter
|
|
||||||
* name="outputDirectory"
|
|
||||||
* type="String"
|
|
||||||
* required="true"
|
|
||||||
* validator=""
|
|
||||||
* expression="#project.build.directory"
|
|
||||||
* description=""
|
|
||||||
*
|
|
||||||
* @parameter
|
|
||||||
* name="jarName"
|
|
||||||
* type="String"
|
|
||||||
* required="true"
|
|
||||||
* validator=""
|
|
||||||
* expression="#maven.final.name"
|
|
||||||
* description=""
|
|
||||||
*
|
|
||||||
* @parameter
|
|
||||||
* name="pluginHome"
|
|
||||||
* type="String"
|
|
||||||
* required="true"
|
|
||||||
* validator=""
|
|
||||||
* expression="#maven.plugin.home"
|
|
||||||
* description=""
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
|
|
||||||
* @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class PluginSetupMojo
|
|
||||||
extends AbstractPluginMojo
|
|
||||||
{
|
|
||||||
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
String pluginHomeName = (String) request.getParameter( "pluginHome" );
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
File jarFile = getJarFile( request );
|
|
||||||
|
|
||||||
File pluginHome = getPluginHome( pluginHomeName );
|
|
||||||
|
|
||||||
System.out.println( "Installing " + jarFile + " in " + pluginHome );
|
|
||||||
|
|
||||||
FileUtils.copyFileToDirectory( jarFile, pluginHome );
|
|
||||||
}
|
|
||||||
|
|
||||||
private File getPluginHome( String pluginHomeName )
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
File pluginHome;
|
|
||||||
|
|
||||||
if ( pluginHomeName == null ||
|
|
||||||
pluginHomeName.trim().length() == 0 ||
|
|
||||||
pluginHomeName.equals( "maven.plugin.home" ) )
|
|
||||||
{
|
|
||||||
String mavenHomeName = System.getProperty( "maven.home" );
|
|
||||||
|
|
||||||
if ( mavenHomeName == null )
|
|
||||||
{
|
|
||||||
String userHomeName = System.getProperty( "user.home" );
|
|
||||||
|
|
||||||
System.out.println( "userHomeName: " + userHomeName );
|
|
||||||
|
|
||||||
File mavenHome = new File( userHomeName, ".m2" );
|
|
||||||
|
|
||||||
if ( !mavenHome.exists() )
|
|
||||||
{
|
|
||||||
mavenHome = new File( userHomeName, "m2" );
|
|
||||||
|
|
||||||
if ( !mavenHome.exists() )
|
|
||||||
{
|
|
||||||
pluginHome = new File( mavenHome, "plugins" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception( "Cannot find the maven plugins directory." );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pluginHome = new File( mavenHome, "plugins" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pluginHome = new File( mavenHomeName, "plugins" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pluginHome = new File( pluginHomeName );
|
|
||||||
}
|
|
||||||
return pluginHome;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,14 +12,26 @@
|
||||||
<name>Maven POM Plugin</name>
|
<name>Maven POM Plugin</name>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<package>org.apache.maven.plugin.pom</package>
|
<package>org.apache.maven.plugin.pom</package>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>maven</groupId>
|
<groupId>maven</groupId>
|
||||||
<artifactId>maven-core</artifactId>
|
<artifactId>maven-core</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>maven</groupId>
|
||||||
|
<artifactId>maven-artifact</artifactId>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>maven</groupId>
|
||||||
|
<artifactId>maven-model</artifactId>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>maven</groupId>
|
||||||
|
<artifactId>wagon-api</artifactId>
|
||||||
|
<version>1.0-alpha-1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.apache.maven.plugin.jar;
|
package org.apache.maven.plugin.pom;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2001-2004 The Apache Software Foundation.
|
* Copyright 2001-2004 The Apache Software Foundation.
|
||||||
|
@ -16,13 +16,15 @@ package org.apache.maven.plugin.jar;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.Artifact;
|
||||||
|
import org.apache.maven.artifact.DefaultArtifact;
|
||||||
|
import org.apache.maven.artifact.deployer.ArtifactDeployer;
|
||||||
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.plugin.AbstractPlugin;
|
import org.apache.maven.plugin.AbstractPlugin;
|
||||||
import org.apache.maven.plugin.PluginExecutionRequest;
|
import org.apache.maven.plugin.PluginExecutionRequest;
|
||||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
import org.apache.maven.plugin.PluginExecutionResponse;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.artifact.installer.ArtifactInstaller;
|
import org.apache.maven.repository.RepositoryUtils;
|
||||||
import org.apache.maven.artifact.deployer.ArtifactDeployer;
|
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -57,6 +59,16 @@ public class PomDeployMojo
|
||||||
|
|
||||||
ArtifactDeployer artifactDeployer = (ArtifactDeployer) request.getParameter( "deployer" );
|
ArtifactDeployer artifactDeployer = (ArtifactDeployer) request.getParameter( "deployer" );
|
||||||
|
|
||||||
artifactDeployer.deploy( project.getFile(), "pom", project );
|
ArtifactRepository deploymentRepository =
|
||||||
|
RepositoryUtils.mavenRepositoryToWagonRepository( project.getDistributionManagement().getRepository() );
|
||||||
|
|
||||||
|
Artifact artifact = new DefaultArtifact( project.getGroupId(),
|
||||||
|
project.getArtifactId(),
|
||||||
|
project.getVersion(),
|
||||||
|
"pom" );
|
||||||
|
|
||||||
|
File pom = new File( project.getFile().getParentFile(), "pom.xml" );
|
||||||
|
|
||||||
|
artifactDeployer.deploy( pom, artifact, deploymentRepository );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.apache.maven.plugin.jar;
|
package org.apache.maven.plugin.pom;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2001-2004 The Apache Software Foundation.
|
* Copyright 2001-2004 The Apache Software Foundation.
|
||||||
|
@ -16,35 +16,43 @@ package org.apache.maven.plugin.jar;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.Artifact;
|
||||||
|
import org.apache.maven.artifact.DefaultArtifact;
|
||||||
|
import org.apache.maven.artifact.installer.ArtifactInstaller;
|
||||||
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.plugin.AbstractPlugin;
|
import org.apache.maven.plugin.AbstractPlugin;
|
||||||
import org.apache.maven.plugin.PluginExecutionRequest;
|
import org.apache.maven.plugin.PluginExecutionRequest;
|
||||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
import org.apache.maven.plugin.PluginExecutionResponse;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.artifact.installer.ArtifactInstaller;
|
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @goal install
|
* @goal install
|
||||||
*
|
*
|
||||||
* @description install a jar in local repository
|
* @description installs project's main artifact in local repository
|
||||||
*
|
*
|
||||||
* @parameter
|
* @parameter name="project"
|
||||||
* name="project"
|
* type="org.apache.maven.project.MavenProject"
|
||||||
* type="org.apache.maven.project.MavenProject"
|
* required="true"
|
||||||
* required="true"
|
* validator=""
|
||||||
* validator=""
|
* expression="#project"
|
||||||
* expression="#project"
|
* description=""
|
||||||
* description=""
|
*
|
||||||
|
* @parameter name="installer"
|
||||||
|
* type="org.apache.maven.artifact.installer.ArtifactInstaller"
|
||||||
|
* required="true"
|
||||||
|
* validator=""
|
||||||
|
* expression="#component.org.apache.maven.artifact.installer.ArtifactInstaller"
|
||||||
|
* description=""
|
||||||
|
*
|
||||||
|
* @parameter name="localRepository"
|
||||||
|
* type="org.apache.maven.artifact.repository.ArtifactRepository"
|
||||||
|
* required="true"
|
||||||
|
* validator=""
|
||||||
|
* expression="#localRepository"
|
||||||
|
* 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
|
public class PomInstallMojo
|
||||||
extends AbstractPlugin
|
extends AbstractPlugin
|
||||||
|
@ -56,6 +64,15 @@ public class PomInstallMojo
|
||||||
|
|
||||||
ArtifactInstaller artifactInstaller = (ArtifactInstaller) request.getParameter( "installer" );
|
ArtifactInstaller artifactInstaller = (ArtifactInstaller) request.getParameter( "installer" );
|
||||||
|
|
||||||
artifactInstaller.install( project.getFile(), "pom", project );
|
ArtifactRepository localRepository = (ArtifactRepository) request.getParameter( "localRepository" );
|
||||||
|
|
||||||
|
Artifact artifact = new DefaultArtifact( project.getGroupId(),
|
||||||
|
project.getArtifactId(),
|
||||||
|
project.getVersion(),
|
||||||
|
"pom" );
|
||||||
|
|
||||||
|
File pom = new File( project.getFile().getParentFile(), "pom.xml" );
|
||||||
|
|
||||||
|
artifactInstaller.install( pom, artifact, localRepository );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
<artifactId>maven-model</artifactId>
|
<artifactId>maven-model</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>plexus</groupId>
|
||||||
|
<artifactId>plexus</artifactId>
|
||||||
|
<version>0.16-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<unitTest>
|
<unitTest>
|
||||||
|
|
|
@ -44,43 +44,13 @@
|
||||||
</roles>
|
</roles>
|
||||||
</developer>
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>maven</groupId>
|
|
||||||
<artifactId>maven-model</artifactId>
|
|
||||||
<version>2.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>maven</groupId>
|
<groupId>maven</groupId>
|
||||||
<artifactId>maven-plugin</artifactId>
|
<artifactId>maven-plugin</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>maven</groupId>
|
|
||||||
<artifactId>wagon-api</artifactId>
|
|
||||||
<version>0.9-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- This will soon be a transitive dep -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>plexus</groupId>
|
|
||||||
<artifactId>plexus</artifactId>
|
|
||||||
<version>0.14-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>classworlds</groupId>
|
|
||||||
<artifactId>classworlds</artifactId>
|
|
||||||
<version>1.1-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>xstream</groupId>
|
|
||||||
<artifactId>xstream</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>xpp3</groupId>
|
|
||||||
<artifactId>xpp3</artifactId>
|
|
||||||
<version>1.1.3.3</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Reference in New Issue