mirror of https://github.com/apache/maven.git
playground for the SCM wagon
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@165269 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
36f970b652
commit
19d8a27354
|
@ -46,6 +46,12 @@
|
|||
<version>1.0-alpha-3-SNAPSHOT</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-scm</artifactId>
|
||||
<version>1.0-alpha-3-SNAPSHOT</version>
|
||||
<!-- temporarily compile time scope>runtime</scope -->
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -37,5 +37,55 @@
|
|||
<pom refid="maven.project"/>
|
||||
</artifact:deploy>
|
||||
</target>
|
||||
|
||||
<target name="test-scm">
|
||||
<mkdir dir="target" />
|
||||
|
||||
<pathconvert targetos="unix" property="repo.path.unix">
|
||||
<map from="c:" to=""/>
|
||||
<path>
|
||||
<pathelement location="${basedir}/target/deployment-repo-scm" />
|
||||
</path>
|
||||
</pathconvert>
|
||||
|
||||
<property name="scm.url" value="file://${repo.path.unix}" />
|
||||
|
||||
<delete dir="${repo.path.unix}" />
|
||||
|
||||
<exec executable="svnadmin" failonerror="true">
|
||||
<arg line="create ${repo.path.unix}" />
|
||||
</exec>
|
||||
|
||||
<artifact:localRepository id="local.repository" location="${basedir}/target/local-repo" layout="default"/>
|
||||
|
||||
<artifact:remoteRepository id="deploy.repository" url="scm:svn:${scm.url}" layout="default"/>
|
||||
|
||||
<artifact:dependencies pathId="dependency.classpath">
|
||||
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-2"/>
|
||||
<dependency groupId="org.codehaus.modello" artifactId="modello-core" version="1.0-alpha-2-SNAPSHOT"/>
|
||||
<localRepository refid="local.repository"/>
|
||||
</artifact:dependencies>
|
||||
|
||||
<exec executable="svn" dir="${basedir}/target/local-repo" failonerror="true">
|
||||
<arg line="import -m 'import' ${scm.url}" />
|
||||
</exec>
|
||||
|
||||
<delete dir="${basedir}/target/local-repo-scm" />
|
||||
|
||||
<artifact:localRepository id="local.repository.scm" location="${basedir}/target/local-repo-scm" layout="default"/>
|
||||
|
||||
<artifact:dependencies pathId="dependency.classpath">
|
||||
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-2"/>
|
||||
<dependency groupId="org.codehaus.modello" artifactId="modello-core" version="1.0-alpha-2-SNAPSHOT"/>
|
||||
<localRepository refid="local.repository.scm"/>
|
||||
<remoteRepository refid="deploy.repository"/>
|
||||
</artifact:dependencies>
|
||||
|
||||
<artifact:deploy file="target/maven-artifact-ant-2.0-SNAPSHOT.jar">
|
||||
<localRepository refid="local.repository.scm"/>
|
||||
<remoteRepository refid="deploy.repository" />
|
||||
<pom refid="maven.project"/>
|
||||
</artifact:deploy>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
|
|
|
@ -42,6 +42,10 @@ public abstract class AbstractArtifactTask
|
|||
{
|
||||
ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
|
||||
repository.getLayout() );
|
||||
|
||||
CustomWagonManager manager = (CustomWagonManager) lookup( WagonManager.ROLE );
|
||||
manager.setLocalRepository( repository.getLocation() );
|
||||
|
||||
return new ArtifactRepository( "local", "file://" + repository.getLocation(), repositoryLayout );
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
package org.apache.maven.artifact.ant;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.manager.DefaultWagonManager;
|
||||
import org.apache.maven.wagon.Wagon;
|
||||
import org.apache.maven.wagon.UnsupportedProtocolException;
|
||||
import org.apache.maven.wagon.providers.scm.ScmWagon;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Custom wagon manager for the ant tasks - used to set the SCM checkout directory to the local repository.
|
||||
*
|
||||
* @todo find a better way and share with m2
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CustomWagonManager
|
||||
extends DefaultWagonManager
|
||||
{
|
||||
private File localRepository;
|
||||
|
||||
public Wagon getWagon( String protocol )
|
||||
throws UnsupportedProtocolException
|
||||
{
|
||||
Wagon wagon = super.getWagon( protocol );
|
||||
|
||||
if ( protocol.equals( "scm" ) )
|
||||
{
|
||||
((ScmWagon)wagon).setCheckoutDirectory( localRepository );
|
||||
}
|
||||
|
||||
return wagon;
|
||||
}
|
||||
|
||||
public void setLocalRepository( File localRepository )
|
||||
{
|
||||
this.localRepository = localRepository;
|
||||
}
|
||||
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
<implementation>org.apache.maven.artifact.manager.DefaultWagonManager</implementation>
|
||||
<implementation>org.apache.maven.artifact.ant.CustomWagonManager</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
|
||||
|
@ -276,6 +276,17 @@
|
|||
<instantiation-strategy>per-lookup</instantiation-strategy>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.wagon.Wagon</role>
|
||||
<role-hint>scm</role-hint>
|
||||
<implementation>org.apache.maven.wagon.providers.scm.ScmWagon</implementation>
|
||||
<instantiation-strategy>per-lookup</instantiation-strategy>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.scm.manager.ScmManager</role>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.wagon.Wagon</role>
|
||||
<role-hint>scp</role-hint>
|
||||
|
@ -293,6 +304,131 @@
|
|||
<implementation>org.apache.maven.wagon.providers.ssh.ScpWagon</implementation>
|
||||
<instantiation-strategy>per-lookup</instantiation-strategy>
|
||||
</component>
|
||||
</components>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.manager.ScmManager</role>
|
||||
<implementation>org.apache.maven.scm.manager.DefaultScmManager</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.scm.provider.ScmProvider</role>
|
||||
<field-name>scmProviders</field-name>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.ScmProvider</role>
|
||||
<role-hint>cvs</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.cvslib.CvsScmProvider</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.scm.provider.cvslib.command.CvsCommand</role>
|
||||
<field-name>commands</field-name>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.cvslib.command.CvsCommand</role>
|
||||
<role-hint>add</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.cvslib.command.add.CvsAddCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.cvslib.command.CvsCommand</role>
|
||||
<role-hint>change-log</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.cvslib.command.changelog.CvsChangeLogCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.cvslib.command.CvsCommand</role>
|
||||
<role-hint>check-in</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.cvslib.command.checkin.CvsCheckInCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.cvslib.command.CvsCommand</role>
|
||||
<role-hint>check-out</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.cvslib.command.checkout.CvsCheckOutCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.cvslib.command.CvsCommand</role>
|
||||
<role-hint>diff</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.cvslib.command.diff.CvsDiffCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.cvslib.command.CvsCommand</role>
|
||||
<role-hint>status</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.cvslib.command.status.CvsStatusCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.cvslib.command.CvsCommand</role>
|
||||
<role-hint>tag</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.cvslib.command.tag.CvsTagCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.cvslib.command.CvsCommand</role>
|
||||
<role-hint>update</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.cvslib.command.update.CvsUpdateCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.ScmProvider</role>
|
||||
<role-hint>svn</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.svn.SvnScmProvider</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.scm.provider.svn.command.SvnCommand</role>
|
||||
<field-name>commands</field-name>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.svn.command.SvnCommand</role>
|
||||
<role-hint>add</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.svn.command.add.SvnAddCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.svn.command.SvnCommand</role>
|
||||
<role-hint>check-in</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.svn.command.checkin.SvnCheckInCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.svn.command.SvnCommand</role>
|
||||
<role-hint>check-out</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.svn.command.checkout.SvnCheckOutCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.svn.command.SvnCommand</role>
|
||||
<role-hint>diff</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.svn.command.diff.SvnDiffCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.svn.command.SvnCommand</role>
|
||||
<role-hint>status</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.svn.command.status.SvnStatusCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.svn.command.SvnCommand</role>
|
||||
<role-hint>tag</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.svn.command.tag.SvnTagCommand</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.scm.provider.svn.command.SvnCommand</role>
|
||||
<role-hint>update</role-hint>
|
||||
<implementation>org.apache.maven.scm.provider.svn.command.update.SvnUpdateCommand</implementation>
|
||||
</component>
|
||||
|
||||
</components>
|
||||
</component-set>
|
||||
|
|
Loading…
Reference in New Issue