build an assembly that includes dependencies

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163968 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-04-18 07:09:16 +00:00
parent 30d097daaa
commit 72997ebd53
9 changed files with 455 additions and 40 deletions

View File

@ -27,5 +27,28 @@
<version>3.8.1</version> <version>3.8.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
<version>1.0-alpha-2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0-alpha-2</version>
<scope>runtime</scope>
</dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<descriptor>src/main/assembly/dep.xml</descriptor>
</configuration>
</plugin>
</plugins>
</build>
</model> </model>

View File

@ -40,6 +40,14 @@ Features:
<remoteRepository refid="deploy.repository"/> <remoteRepository refid="deploy.repository"/>
<pom refid="maven.project"/> <pom refid="maven.project"/>
</artifact:deploy> </artifact:deploy>
<artifact:deploy file="target/maven-artifact-ant-1.0-alpha-2-SNAPSHOT.jar">
<localRepository refid="local.repository"/>
<remoteRepository url="scp://localhost/tmp/deployment-repo">
<authentication username="brett" privateKey="${user.home}/.ssh/id_dsa"/>
</remoteRepository>
<pom refid="maven.project"/>
</artifact:deploy>
</target> </target>
</project> </project>

View File

@ -0,0 +1,34 @@
<assembly>
<!-- TODO: a jarjar format would be better -->
<id>dep</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<!-- TODO: use expressions instead: ${project.build.directory}, ${project.build.finalName}, or have a <build /> tag to include the built artifact -->
<directory>target/classes</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<unpack>true</unpack>
<scope>runtime</scope>
<excludes>
<exclude>junit:junit</exclude>
<exclude>ant:ant</exclude>
<exclude>marmalade:marmalade-core</exclude>
<exclude>plexus:plexus-marmalade-factory</exclude>
<exclude>commons-cli:commons-cli</exclude>
<exclude>plexus:plexus-container-artifact</exclude>
<exclude>plexus:plexus-i18n</exclude>
<exclude>org.apache.maven:maven-script-marmalade</exclude>
<exclude>org.apache.maven:maven-plugin</exclude>
<exclude>org.apache.maven:maven-monitor</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>

View File

@ -36,19 +36,16 @@ public abstract class AbstractArtifactTask
protected ArtifactRepository createArtifactRepository( LocalRepository repository ) protected ArtifactRepository createArtifactRepository( LocalRepository repository )
{ {
return createArtifactRepository( "local", "file://" + repository.getLocation(), repository.getLayout() ); ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
repository.getLayout() );
return new ArtifactRepository( "local", "file://" + repository.getLocation(), repositoryLayout );
} }
protected ArtifactRepository createArtifactRepository( RemoteRepository repository ) protected ArtifactRepository createArtifactRepository( RemoteRepository repository )
{
return createArtifactRepository( "remote", repository.getUrl(), repository.getLayout() );
}
private ArtifactRepository createArtifactRepository( String id, String url, String layout )
{ {
ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
layout ); repository.getLayout() );
return new ArtifactRepository( id, url, repositoryLayout ); return new ArtifactRepository( "remote", repository.getUrl(), repository.getAuthentication(), repositoryLayout );
} }
protected Object lookup( String role ) protected Object lookup( String role )

View File

@ -0,0 +1,30 @@
package org.apache.maven.artifact.ant;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
/*
* Copyright 2001-2005 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.
*/
/**
* Ant Wrapper for wagon authentication.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/
public class Authentication
extends AuthenticationInfo
{
}

View File

@ -18,12 +18,11 @@ package org.apache.maven.artifact.ant;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact; import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.installer.ArtifactInstaller;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
import org.apache.maven.artifact.deployer.ArtifactDeployer; import org.apache.maven.artifact.deployer.ArtifactDeployer;
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.metadata.MavenMetadata; import org.apache.maven.artifact.metadata.MavenMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.MavenProjectBuilder;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
@ -63,6 +62,7 @@ public class DeployTask
artifact.addMetadata( metadata ); artifact.addMetadata( metadata );
} }
log( "Deploying to " + remoteRepository.getUrl() );
ArtifactDeployer deployer = (ArtifactDeployer) lookup( ArtifactDeployer.ROLE ); ArtifactDeployer deployer = (ArtifactDeployer) lookup( ArtifactDeployer.ROLE );
try try
{ {

View File

@ -22,10 +22,13 @@ package org.apache.maven.artifact.ant;
* @author <a href="mailto:brett@apache.org">Brett Porter</a> * @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$ * @version $Id$
*/ */
public class RemoteRepository extends Repository public class RemoteRepository
extends Repository
{ {
private String url; private String url;
private Authentication authentication;
public String getUrl() public String getUrl()
{ {
return ( (RemoteRepository) getInstance() ).url; return ( (RemoteRepository) getInstance() ).url;
@ -35,4 +38,14 @@ public class RemoteRepository extends Repository
{ {
this.url = url; this.url = url;
} }
public Authentication getAuthentication()
{
return authentication;
}
public void addAuthentication( Authentication authentication )
{
this.authentication = authentication;
}
} }

View File

@ -0,0 +1,309 @@
<!-- Merger of component descriptors from maven-artifact and maven-core because extracted jars overwrite each other -->
<component-set>
<components>
<!--
|
| WagonManager
|
-->
<component>
<role>org.apache.maven.artifact.manager.WagonManager</role>
<implementation>org.apache.maven.artifact.manager.DefaultWagonManager</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
</requirement>
</requirements>
</component>
<!--
|
| Transformations
|
-->
<component>
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
<implementation>org.apache.maven.artifact.transform.SnapshotTransformation</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.manager.WagonManager</role>
</requirement>
</requirements>
</component>
<!--
|
| Resolver
|
-->
<component>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
<implementation>org.apache.maven.artifact.resolver.DefaultArtifactResolver</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.manager.WagonManager</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
<field-name>artifactTransformations</field-name>
</requirement>
</requirements>
</component>
<!--
|
| ArtifactInstaller
|
-->
<component>
<role>org.apache.maven.artifact.installer.ArtifactInstaller</role>
<implementation>org.apache.maven.artifact.installer.DefaultArtifactInstaller</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
<field-name>artifactTransformations</field-name>
</requirement>
</requirements>
</component>
<!--
|
| ArtifactDeployer
|
-->
<component>
<role>org.apache.maven.artifact.deployer.ArtifactDeployer</role>
<implementation>org.apache.maven.artifact.deployer.DefaultArtifactDeployer</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.manager.WagonManager</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
<field-name>artifactTransformations</field-name>
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout</role>
<role-hint>default</role-hint>
<implementation>org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout</role>
<role-hint>legacy</role-hint>
<implementation>org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
</requirement>
</requirements>
</component>
<!--
|
| ArtifactHandlerManager
|
-->
<component>
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
<implementation>org.apache.maven.artifact.handler.manager.DefaultArtifactHandlerManager</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<field-name>artifactHandlers</field-name>
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>ejb</role-hint>
<implementation>org.apache.maven.artifact.handler.EjbHandler</implementation>
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>plexus-service</role-hint>
<implementation>org.apache.maven.artifact.handler.PlexusServiceHandler</implementation>
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>jar</role-hint>
<implementation>org.apache.maven.artifact.handler.JarHandler</implementation>
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>maven-plugin</role-hint>
<implementation>org.apache.maven.artifact.handler.PluginHandler</implementation>
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>pom</role-hint>
<implementation>org.apache.maven.artifact.handler.PomHandler</implementation>
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>source</role-hint>
<implementation>org.apache.maven.artifact.handler.SourceHandler</implementation>
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>war</role-hint>
<implementation>org.apache.maven.artifact.handler.WarHandler</implementation>
</component>
<!--
|
|
|
-->
<component>
<role>org.apache.maven.project.interpolation.ModelInterpolator</role>
<implementation>org.apache.maven.project.interpolation.RegexBasedModelInterpolator</implementation>
</component>
<!--
|
|
|
-->
<component>
<role>org.apache.maven.project.injection.ModelDefaultsInjector</role>
<implementation>org.apache.maven.project.injection.DefaultModelDefaultsInjector</implementation>
</component>
<component>
<role>org.apache.maven.project.MavenProjectBuilder</role>
<implementation>org.apache.maven.project.DefaultMavenProjectBuilder</implementation>
<requirements>
<requirement>
<role>org.apache.maven.project.injection.ModelDefaultsInjector</role>
</requirement>
<requirement>
<role>org.apache.maven.project.interpolation.ModelInterpolator</role>
</requirement>
<requirement>
<role>org.apache.maven.project.inheritance.ModelInheritanceAssembler</role>
</requirement>
<requirement>
<role>org.apache.maven.project.validation.ModelValidator</role>
</requirement>
<requirement>
<role>org.apache.maven.project.path.PathTranslator</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
</requirement>
<requirement>
<role>org.apache.maven.settings.MavenSettingsBuilder</role>
</requirement>
</requirements>
</component>
<!--
|
|
|
-->
<component>
<role>org.apache.maven.project.inheritance.ModelInheritanceAssembler</role>
<implementation>org.apache.maven.project.inheritance.DefaultModelInheritanceAssembler</implementation>
</component>
<!--
|
|
|
-->
<component>
<role>org.apache.maven.project.validation.ModelValidator</role>
<implementation>org.apache.maven.project.validation.DefaultModelValidator</implementation>
</component>
<!--
|
|
|
-->
<component>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
<implementation>org.apache.maven.artifact.factory.DefaultArtifactFactory</implementation>
</component>
<component>
<role>org.apache.maven.project.path.PathTranslator</role>
<implementation>org.apache.maven.project.path.DefaultPathTranslator</implementation>
</component>
<component>
<role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
<implementation>org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory</implementation>
</component>
<component>
<role>org.apache.maven.settings.MavenSettingsBuilder</role>
<implementation>org.apache.maven.settings.DefaultMavenSettingsBuilder</implementation>
<configuration>
<settingsPath>${user.home}/.m2/settings.xml</settingsPath>
</configuration>
</component>
<component>
<role>org.apache.maven.wagon.Wagon</role>
<role-hint>http</role-hint>
<implementation>org.apache.maven.wagon.providers.http.LightweightHttpWagon</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
</component>
<component>
<role>org.apache.maven.wagon.Wagon</role>
<role-hint>file</role-hint>
<implementation>org.apache.maven.wagon.providers.file.FileWagon</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
</component>
<component>
<role>org.apache.maven.wagon.Wagon</role>
<role-hint>scp</role-hint>
<implementation>org.apache.maven.wagon.providers.ssh.ScpWagon</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
</component>
<component>
<role>org.apache.maven.wagon.Wagon</role>
<role-hint>sftp</role-hint>
<implementation>org.apache.maven.wagon.providers.ssh.SftpWagon</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
</component>
<component>
<role>org.apache.maven.wagon.providers.ssh.SshCommandExecutor</role>
<implementation>org.apache.maven.wagon.providers.ssh.ScpWagon</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
</component>
</components>
</component-set>

View File

@ -8,5 +8,6 @@
<!-- Types --> <!-- Types -->
<typedef name="localRepository" classname="org.apache.maven.artifact.ant.LocalRepository"/> <typedef name="localRepository" classname="org.apache.maven.artifact.ant.LocalRepository"/>
<typedef name="remoteRepository" classname="org.apache.maven.artifact.ant.RemoteRepository"/> <typedef name="remoteRepository" classname="org.apache.maven.artifact.ant.RemoteRepository"/>
<typedef name="authentication" classname="org.apache.maven.artifact.ant.Authentication"/>
<typedef name="pom" classname="org.apache.maven.artifact.ant.Pom"/> <typedef name="pom" classname="org.apache.maven.artifact.ant.Pom"/>
</antlib> </antlib>