*** empty log message ***

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163022 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Trygve Laugstol 2004-08-31 11:47:13 +00:00
parent 12344d3bca
commit 4d1ac08117
18 changed files with 64 additions and 306 deletions

View File

@ -34,7 +34,7 @@
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus</artifactId>
<version>0.14-SNAPSHOT</version>
<version>0.17-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -23,7 +23,7 @@ public class Maven1Repository
public Iterator getArtifactsByType( String type )
throws Exception
{
List files = FileUtils.getFiles( getRepository(), "*/" + type + "s/*." + type, "" );
List files = FileUtils.getFiles( getRepository(), "tambora*/" + type + "s/*." + type, "" );
Collections.sort( files );

View File

@ -14,6 +14,10 @@ import java.io.Writer;
import java.security.MessageDigest;
import java.util.Iterator;
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.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
@ -27,15 +31,21 @@ import org.codehaus.plexus.util.IOUtil;
public class Maven2Repository
extends AbstractMavenRepository
{
private ArtifactInstaller installer;
public Iterator getArtifactsByType( String type )
throws Exception
{
throw new Exception( "Not implemented." );
}
public void installArtifact( File artifact, Model model )
public void installArtifact( File artifactFile, Model model )
throws Exception
{
ArtifactRepository repository = new ArtifactRepository();
repository.setBasedir( getRepository().getAbsolutePath() );
/*
String type = model.getType();
if ( type.equals( "jar" ) )
@ -46,6 +56,10 @@ public class Maven2Repository
{
throw new Exception( "This installer can only handle jars." );
}
*/
Artifact artifact = new DefaultArtifact( model.getGroupId(), model.getArtifactId(), model.getVersion(), model.getType() );
installer.install( artifactFile, artifact, repository );
}
public String getPomForArtifact( String artifactPath )

View File

@ -15,6 +15,8 @@ import org.apache.maven.model.Model;
*/
public interface MavenRepository
{
String ROLE = MavenRepository.class.getName();
void setRepository( File repository );
File getRepository();

View File

@ -51,7 +51,7 @@ import org.apache.maven.model.Site;
import org.apache.maven.model.SourceModification;
import org.apache.maven.model.UnitTest;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.model.v300.io.xpp3.MavenV300Xpp3Reader;
import org.apache.maven.model.v300.io.xpp3.MavenXpp3Reader;
import org.codehaus.plexus.util.FileUtils;
@ -791,12 +791,13 @@ public class PomV3ToV4Converter
private org.apache.maven.model.v300.Model loadV3Pom( File inputFile )
throws Exception
{
MavenV300Xpp3Reader v3Reader = new MavenV300Xpp3Reader();
MavenXpp3Reader v3Reader = new MavenXpp3Reader();
org.apache.maven.model.v300.Model model;
model = v3Reader.read( new FileReader( inputFile ) );
/*
String id = model.getId();
String groupId = model.getGroupId();
@ -842,7 +843,7 @@ public class PomV3ToV4Converter
model.setArtifactId( artifactId );
}
}
*/
return model;
}

View File

@ -21,16 +21,14 @@ import java.util.Iterator;
import org.apache.maven.model.Model;
import org.codehaus.plexus.embed.ArtifactEnabledEmbedder;
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l </a>
* @version $Id$
*/
public class RepoReaper
{
MavenRepository inRepository = new Maven1Repository();
MavenRepository outRepository = new Maven2Repository();
public static void main( String[] args )
throws Exception
{
@ -65,6 +63,14 @@ public class RepoReaper
public void work( File inbase, File outbase )
throws Exception
{
ArtifactEnabledEmbedder embedder = new ArtifactEnabledEmbedder();
embedder.start();
MavenRepository inRepository = (MavenRepository)embedder.lookup( MavenRepository.ROLE, "maven1" );
MavenRepository outRepository = (MavenRepository)embedder.lookup( MavenRepository.ROLE, "maven2" );
inRepository.setRepository( inbase );
System.out.println( "Input basedir: " + inbase.getAbsolutePath() );

View File

@ -1,4 +1,4 @@
package org.apache.maven.converter;
package org.apache.maven.converter.old;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.

View File

@ -1,4 +1,4 @@
package org.apache.maven.converter;
package org.apache.maven.converter.old;
/* ====================================================================
* Copyright 2001-2004 The Apache Software Foundation.

View File

@ -1,4 +1,4 @@
package org.apache.maven.converter;
package org.apache.maven.converter.old;
/*
* Copyright 2001-2004 The Apache Software Foundation.

View File

@ -1,4 +1,4 @@
package org.apache.maven.converter;
package org.apache.maven.converter.old;
/*
* Copyright 2001-2004 The Apache Software Foundation.

View File

@ -1,4 +1,4 @@
package org.apache.maven.converter;
package org.apache.maven.converter.old;
/*
* Copyright 2001-2004 The Apache Software Foundation.

View File

@ -1,41 +0,0 @@
package org.apache.maven.converter.project;
/*
* Copyright (c) 2004, Jason van Zyl and Trygve Laugstøl
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id$
*/
public class Model300Converter
implements ModelConverter
{
// ----------------------------------------------------------------------
// ModelConverter Implementation
// ----------------------------------------------------------------------
public Object convert( Object fromModel )
throws ModelConversionException
{
return null;
}
}

View File

@ -1,40 +0,0 @@
package org.apache.maven.converter.project;
/*
* Copyright (c) 2004, Jason van Zyl and Trygve Laugstøl
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id$
*/
public class ModelConversionException extends Exception
{
public ModelConversionException( String msg )
{
super( msg );
}
public ModelConversionException( String msg, Throwable cause )
{
super( msg, cause );
}
}

View File

@ -1,39 +0,0 @@
package org.apache.maven.converter.project;
/*
* Copyright (c) 2004, Jason van Zyl and Trygve Laugstøl
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id$
*/
public interface ModelConverter
{
/**
*
* @param model The model to convert from.
* @return Returns the new model.
* @throws ModelConversionException
*/
Object convert( Object model )
throws ModelConversionException;
}

View File

@ -1,85 +0,0 @@
package org.apache.maven.converter.tmp;
/*
* 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.
*/
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id$
*/
public class Dependency
{
private String groupId;
private String artifactId;
private String type;
private String version;
/**
* @return Returns the artifactId.
*/
public String getArtifactId()
{
return artifactId;
}
/**
* @param artifactId The artifactId to set.
*/
public void setArtifactId( String artifactId )
{
this.artifactId = artifactId;
}
/**
* @return Returns the groupId.
*/
public String getGroupId()
{
return groupId;
}
/**
* @param groupId The groupId to set.
*/
public void setGroupId( String groupId )
{
this.groupId = groupId;
}
/**
* @return Returns the type.
*/
public String getType()
{
return type;
}
/**
* @param type The type to set.
*/
public void setType( String type )
{
this.type = type;
}
/**
* @return Returns the version.
*/
public String getVersion()
{
return version;
}
/**
* @param version The version to set.
*/
public void setVersion( String version )
{
this.version = version;
}
}

View File

@ -1,86 +0,0 @@
package org.apache.maven.converter.tmp;
/*
* 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.
*/
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id$
*/
public class Project
{
private String groupId;
private String artifactId;
private String version;
private String type;
/**
* @return Returns the artifactId.
*/
public String getArtifactId()
{
return artifactId;
}
/**
* @param artifactId The artifactId to set.
*/
public void setArtifactId( String artifactId )
{
this.artifactId = artifactId;
}
/**
* @return Returns the groupId.
*/
public String getGroupId()
{
return groupId;
}
/**
* @param groupId The groupId to set.
*/
public void setGroupId( String groupId )
{
this.groupId = groupId;
}
/**
* @return Returns the type.
*/
public String getType()
{
return type;
}
/**
* @param type The type to set.
*/
public void setType( String type )
{
this.type = type;
}
/**
* @return Returns the version.
*/
public String getVersion()
{
return version;
}
/**
* @param version The version to set.
*/
public void setVersion( String version )
{
this.version = version;
}
}

View File

@ -0,0 +1,19 @@
<component-set>
<components>
<component>
<role>org.apache.maven.converter.MavenRepository</role>
<role-hint>maven1</role-hint>
<implementation>org.apache.maven.converter.Maven1Repository</implementation>
</component>
<component>
<role>org.apache.maven.converter.MavenRepository</role>
<role-hint>maven2</role-hint>
<implementation>org.apache.maven.converter.Maven2Repository</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.installer.ArtifactInstaller</role>
</requirement>
</requirements>
</component>
</components>
</component-set>

View File

@ -18,6 +18,8 @@ package org.apache.maven.converter;
import java.io.File;
import org.codehaus.plexus.DefaultArtifactEnabledContainer;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
@ -28,6 +30,11 @@ import org.codehaus.plexus.util.FileUtils;
public class ReaperTest
extends PlexusTestCase
{
public PlexusContainer getContainerInstance()
{
return new DefaultArtifactEnabledContainer();
}
public void testReaper()
throws Exception
{