mirror of https://github.com/apache/maven.git
update the archetypes
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163837 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9408e4607d
commit
f4ecf6bf08
|
@ -11,25 +11,20 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>plexus</groupId>
|
<groupId>plexus</groupId>
|
||||||
<artifactId>plexus-container-default</artifactId>
|
<artifactId>plexus-utils</artifactId>
|
||||||
<version>1.0-alpha-2</version>
|
<version>1.0-alpha-2</version>
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>plexus</groupId>
|
<groupId>plexus</groupId>
|
||||||
<artifactId>plexus-velocity</artifactId>
|
<artifactId>plexus-velocity</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<artifactId>maven-artifact</artifactId>
|
<artifactId>maven-artifact</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.wagon</groupId>
|
<groupId>org.apache.maven.wagon</groupId>
|
||||||
<artifactId>wagon-http-lightweight</artifactId>
|
<artifactId>wagon-http-lightweight</artifactId>
|
||||||
|
@ -37,5 +32,6 @@
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
-->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</model>
|
</model>
|
||||||
|
|
|
@ -17,15 +17,14 @@ package org.apache.maven.archetype;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
|
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||||
|
@ -57,21 +56,22 @@ public class ArchetypeTest
|
||||||
// This needs to be encapsulated in a maven test case.
|
// This needs to be encapsulated in a maven test case.
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
File mavenPropertiesFile = new File( System.getProperty( "user.home" ), ".m2/maven.properties" );
|
ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE,
|
||||||
|
"default" );
|
||||||
|
|
||||||
Properties mavenProperties = new Properties();
|
String mavenRepoLocal = getTestFile( "target/local-repository" ).toURL().toString();
|
||||||
|
ArtifactRepository localRepository = new ArtifactRepository( "local", mavenRepoLocal, layout );
|
||||||
mavenProperties.load( new FileInputStream( mavenPropertiesFile ) );
|
|
||||||
|
|
||||||
ArtifactRepository localRepository = new ArtifactRepository( "local", "file://" + mavenProperties.getProperty( "maven.repo.local" ) );
|
|
||||||
|
|
||||||
List remoteRepositories = new ArrayList();
|
List remoteRepositories = new ArrayList();
|
||||||
|
|
||||||
ArtifactRepository remoteRepository = new ArtifactRepository( "remote", "http://repo1.maven.org" );
|
String mavenRepoRemote = getTestFile( "src/test/repository" ).toURL().toString();
|
||||||
|
ArtifactRepository remoteRepository = new ArtifactRepository( "remote", mavenRepoRemote, layout );
|
||||||
|
|
||||||
remoteRepositories.add( remoteRepository );
|
remoteRepositories.add( remoteRepository );
|
||||||
|
|
||||||
archetype.createArchetype( "maven", "maven-archetype-quickstart", "1.0-alpha-1-SNAPSHOT",
|
archetype.createArchetype( "org.apache.maven.archetypes", "maven-archetype-quickstart", "1.0-alpha-1-SNAPSHOT",
|
||||||
localRepository, remoteRepositories, parameters );
|
localRepository, remoteRepositories, parameters );
|
||||||
|
|
||||||
|
// TODO: validate output
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
<model>
|
<model>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-plugin-parent</artifactId>
|
<artifactId>maven-plugin-parent</artifactId>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.apache.maven.plugin.archetype;
|
package org.apache.maven.plugin.archetype;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2001-2004 The Apache Software Foundation.
|
* Copyright 2001-2005 The Apache Software Foundation.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -19,94 +19,80 @@ package org.apache.maven.plugin.archetype;
|
||||||
import org.apache.maven.archetype.Archetype;
|
import org.apache.maven.archetype.Archetype;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.plugin.AbstractPlugin;
|
import org.apache.maven.plugin.AbstractPlugin;
|
||||||
|
import org.apache.maven.plugin.PluginExecutionException;
|
||||||
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 java.util.ArrayList;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @goal create
|
* @goal create
|
||||||
*
|
|
||||||
* @description Builds archetype containers.
|
* @description Builds archetype containers.
|
||||||
*
|
* @parameter name="archetype"
|
||||||
* @parameter
|
|
||||||
* name="archetype"
|
|
||||||
* type="org.apache.maven.archetype.Archetype"
|
* type="org.apache.maven.archetype.Archetype"
|
||||||
* required="true"
|
* required="true"
|
||||||
* validator=""
|
* validator=""
|
||||||
* expression="#component.org.apache.maven.archetype.Archetype"
|
* expression="#component.org.apache.maven.archetype.Archetype"
|
||||||
* description=""
|
* description=""
|
||||||
*
|
* @parameter name="localRepository"
|
||||||
* @parameter
|
|
||||||
* name="localRepository"
|
|
||||||
* type="org.apache.maven.artifact.ArtifactRepository"
|
* type="org.apache.maven.artifact.ArtifactRepository"
|
||||||
* required="true"
|
* required="true"
|
||||||
* validator=""
|
* validator=""
|
||||||
* expression="#localRepository"
|
* expression="#localRepository"
|
||||||
* description=""
|
* description=""
|
||||||
*
|
* @parameter name="archetypeGroupId"
|
||||||
* @parameter
|
|
||||||
* name="archetypeGroupId"
|
|
||||||
* type="String"
|
* type="String"
|
||||||
* required="true"
|
* required="true"
|
||||||
* validator=""
|
* validator=""
|
||||||
* expression="#archetypeGroupId"
|
* expression="#archetypeGroupId"
|
||||||
* default="maven"
|
* default="org.apache.maven.archetypes"
|
||||||
* description=""
|
* description=""
|
||||||
*
|
* @parameter name="archetypeArtifactId"
|
||||||
* @parameter
|
|
||||||
* name="archetypeArtifactId"
|
|
||||||
* type="String"
|
* type="String"
|
||||||
* required="true"
|
* required="true"
|
||||||
* validator=""
|
* validator=""
|
||||||
* expression="#archetypeArtifactId"
|
* expression="#archetypeArtifactId"
|
||||||
* default="maven"
|
* default="maven-archetype-quickstart"
|
||||||
* description=""
|
* description=""
|
||||||
*
|
* @parameter name="archetypeVersion"
|
||||||
* @parameter
|
|
||||||
* name="archetypeVersion"
|
|
||||||
* type="String"
|
* type="String"
|
||||||
* required="true"
|
* required="true"
|
||||||
* validator=""
|
* validator=""
|
||||||
* expression="#archetypeVersion"
|
* expression="#archetypeVersion"
|
||||||
* default="maven"
|
* default="1.0-alpha-1-SNAPSHOT"
|
||||||
* description=""
|
* description=""
|
||||||
*
|
* @parameter name="groupId"
|
||||||
* @parameter
|
|
||||||
* name="groupId"
|
|
||||||
* type="String"
|
* type="String"
|
||||||
* required="true"
|
* required="true"
|
||||||
* validator=""
|
* validator=""
|
||||||
* expression="#groupId"
|
* expression="#groupId"
|
||||||
* default="maven"
|
|
||||||
* description=""
|
* description=""
|
||||||
*
|
* @parameter name="artifactId"
|
||||||
* @parameter
|
|
||||||
* name="artifactId"
|
|
||||||
* type="String"
|
* type="String"
|
||||||
* required="true"
|
* required="true"
|
||||||
* validator=""
|
* validator=""
|
||||||
* expression="#artifactId"
|
* expression="#artifactId"
|
||||||
* default="quickstart"
|
|
||||||
* description=""
|
* description=""
|
||||||
*
|
* @parameter name="version"
|
||||||
* @parameter
|
|
||||||
* name="version"
|
|
||||||
* type="String"
|
* type="String"
|
||||||
* required="true"
|
* required="true"
|
||||||
* validator=""
|
* validator=""
|
||||||
* expression="#version"
|
* expression="#version"
|
||||||
* default="1.0"
|
* default="1.0-SNAPSHOT"
|
||||||
* description=""
|
* description=""
|
||||||
*
|
* @parameter name="package"
|
||||||
* @parameter
|
|
||||||
* name="package"
|
|
||||||
* type="String"
|
* type="String"
|
||||||
* required="true"
|
* required="true"
|
||||||
* validator=""
|
* validator=""
|
||||||
* expression="#package"
|
* expression="#package"
|
||||||
* default="org.apache.maven.quickstart"
|
* default="com.mycompany.app"
|
||||||
|
* description=""
|
||||||
|
* @parameter name="remoteRepositories"
|
||||||
|
* type="java.util.List"
|
||||||
|
* required="true"
|
||||||
|
* validator=""
|
||||||
|
* expression="#project.remoteArtifactRepositories"
|
||||||
* description=""
|
* description=""
|
||||||
*/
|
*/
|
||||||
public class MavenArchetypePlugin
|
public class MavenArchetypePlugin
|
||||||
|
@ -115,6 +101,10 @@ public class MavenArchetypePlugin
|
||||||
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
// TODO: prompt for missing values
|
||||||
|
// TODO: use new plugin type
|
||||||
|
// TODO: configurable license
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// archetypeGroupId
|
// archetypeGroupId
|
||||||
// archetypeArtifactId
|
// archetypeArtifactId
|
||||||
|
@ -125,17 +115,10 @@ public class MavenArchetypePlugin
|
||||||
// parameters
|
// parameters
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
// When there is no project how do we get the local repository and remote repos.
|
|
||||||
// The local repository will always be present but the remote is in the POM except
|
|
||||||
// for the super POM ...
|
|
||||||
|
|
||||||
ArtifactRepository localRepository = (ArtifactRepository) request.getParameter( "localRepository" );
|
ArtifactRepository localRepository = (ArtifactRepository) request.getParameter( "localRepository" );
|
||||||
|
|
||||||
List remoteRepositories = new ArrayList();
|
// From the super POM
|
||||||
|
List remoteRepositories = (List) request.getParameter( "remoteRepositories" );
|
||||||
ArtifactRepository remoteRepository = new ArtifactRepository( "remote", "http://repo1.maven.org" );
|
|
||||||
|
|
||||||
remoteRepositories.add( remoteRepository );
|
|
||||||
|
|
||||||
String archetypeGroupId = (String) request.getParameter( "archetypeGroupId" );
|
String archetypeGroupId = (String) request.getParameter( "archetypeGroupId" );
|
||||||
|
|
||||||
|
@ -145,9 +128,19 @@ public class MavenArchetypePlugin
|
||||||
|
|
||||||
Archetype archetype = (Archetype) request.getParameter( "archetype" );
|
Archetype archetype = (Archetype) request.getParameter( "archetype" );
|
||||||
|
|
||||||
request.getParameters().put( "outputDirectory", System.getProperty( "user.dir" ) );
|
String basedir = System.getProperty( "user.dir" );
|
||||||
|
|
||||||
archetype.createArchetype( archetypeGroupId, archetypeArtifactId, archetypeVersion,
|
// TODO: allow this to be configured
|
||||||
localRepository, remoteRepositories, request.getParameters() );
|
File outputDirectory = new File( basedir, (String) request.getParameter( "artifactId" ) );
|
||||||
|
request.getParameters().put( "outputDirectory", outputDirectory.getAbsolutePath() );
|
||||||
|
|
||||||
|
if ( outputDirectory.exists() )
|
||||||
|
{
|
||||||
|
throw new PluginExecutionException(
|
||||||
|
outputDirectory.getName() + " already exists - please run from a clean directory" );
|
||||||
|
}
|
||||||
|
|
||||||
|
archetype.createArchetype( archetypeGroupId, archetypeArtifactId, archetypeVersion, localRepository,
|
||||||
|
remoteRepositories, request.getParameters() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<model>
|
<model>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-archetypes</artifactId>
|
<artifactId>maven-archetypes</artifactId>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven.archetypes</groupId>
|
||||||
<version>1.0-alpha-1-SNAPSHOT</version>
|
<version>1.0-alpha-1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
|
@ -2,15 +2,20 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>${groupId}</groupId>
|
<groupId>${groupId}</groupId>
|
||||||
<artifactId>${artifactId}</artifactId>
|
<artifactId>${artifactId}</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>maven-plugin</packaging>
|
||||||
<version>${version}</version>
|
<version>${version}</version>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-plugin</artifactId>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<type>jar</type>
|
<scope>test</scope>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</model>
|
</model>
|
||||||
|
|
|
@ -1,45 +1,51 @@
|
||||||
package $package;
|
package $package;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.plugin.AbstractPlugin;
|
import org.apache.maven.plugin.AbstractPlugin;
|
||||||
import org.apache.maven.plugin.PluginExecutionRequest;
|
import org.apache.maven.plugin.PluginExecutionException;
|
||||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @goal touch
|
* @goal touch
|
||||||
*
|
*
|
||||||
* @phase process-sources
|
* @phase process-sources
|
||||||
*
|
*
|
||||||
* @description Goal which cleans the build
|
* @description Goal which touches a timestamp file
|
||||||
*
|
*
|
||||||
* @parameter
|
* @parameter
|
||||||
* name="outputDirectory"
|
* name="outputDirectory"
|
||||||
* type="String"
|
|
||||||
* required="true"
|
|
||||||
* validator=""
|
|
||||||
* expression="#project.build.directory"
|
|
||||||
* description=""
|
|
||||||
*
|
|
||||||
* @parameter
|
|
||||||
* name="basedirAlignmentDirectory"
|
|
||||||
* type="java.io.File"
|
* type="java.io.File"
|
||||||
* required="true"
|
* required="true"
|
||||||
* validator=""
|
* validator=""
|
||||||
* expression="target/test-basedir-alignment"
|
* expression="#project.build.directory"
|
||||||
* description=""
|
* description=""
|
||||||
*/
|
*/
|
||||||
public class MyMojo
|
public class MyMojo
|
||||||
extends AbstractPlugin
|
extends AbstractPlugin
|
||||||
{
|
{
|
||||||
private static final int DELETE_RETRY_SLEEP_MILLIS = 10;
|
private String outputDirectory;
|
||||||
|
|
||||||
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
public void execute()
|
||||||
throws Exception
|
throws PluginExecutionException
|
||||||
{
|
{
|
||||||
String outputDirectory = (String) request.getParameter( "outputDirectory" );
|
|
||||||
|
|
||||||
File f = new File( outputDirectory );
|
File f = new File( outputDirectory );
|
||||||
|
|
||||||
if ( !f.exists() )
|
if ( !f.exists() )
|
||||||
|
@ -49,30 +55,30 @@ public class MyMojo
|
||||||
|
|
||||||
File touch = new File( f, "touch.txt" );
|
File touch = new File( f, "touch.txt" );
|
||||||
|
|
||||||
FileWriter w = new FileWriter( touch );
|
FileWriter w = null;
|
||||||
|
try
|
||||||
w.write( "touch.txt" );
|
|
||||||
|
|
||||||
w.close();
|
|
||||||
|
|
||||||
// This parameter should be aligned to the basedir as the parameter type is specified
|
|
||||||
// as java.io.File
|
|
||||||
|
|
||||||
String basedirAlignmentDirectory = (String) request.getParameter( "basedirAlignmentDirectory" );
|
|
||||||
|
|
||||||
f = new File( basedirAlignmentDirectory );
|
|
||||||
|
|
||||||
if ( !f.exists() )
|
|
||||||
{
|
{
|
||||||
f.mkdirs();
|
|
||||||
}
|
|
||||||
|
|
||||||
touch = new File( f, "touch.txt" );
|
|
||||||
|
|
||||||
w = new FileWriter( touch );
|
w = new FileWriter( touch );
|
||||||
|
|
||||||
w.write( "touch.txt" );
|
w.write( "touch.txt" );
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
throw new PluginExecutionException( "Error creating file " + touch );
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if ( w != null )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
w.close();
|
w.close();
|
||||||
}
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<model>
|
<model>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-archetypes</artifactId>
|
<artifactId>maven-archetypes</artifactId>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven.archetypes</groupId>
|
||||||
<version>1.0-alpha-1-SNAPSHOT</version>
|
<version>1.0-alpha-1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<type>jar</type>
|
<scope>test</scope>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</model>
|
</model>
|
|
@ -3,8 +3,6 @@ package $package;
|
||||||
/**
|
/**
|
||||||
* Hello world!
|
* Hello world!
|
||||||
*
|
*
|
||||||
* @author <a href="jason@zenplex.com">Jason van Zyl</a>
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class App
|
public class App
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
package $package;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Abstract base class for test cases.
|
|
||||||
*
|
|
||||||
* @author <a href="jason@zenplex.com">Jason van Zyl</a>
|
|
||||||
*/
|
|
||||||
public abstract class AbstractTestCase
|
|
||||||
extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Basedir for all file I/O. Important when running tests from
|
|
||||||
* the reactor.
|
|
||||||
*/
|
|
||||||
public String basedir = System.getProperty("basedir");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*/
|
|
||||||
public AbstractTestCase(String testName)
|
|
||||||
{
|
|
||||||
super(testName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get test input file.
|
|
||||||
*
|
|
||||||
* @param path Path to test input file.
|
|
||||||
*/
|
|
||||||
public String getTestFile(String path)
|
|
||||||
{
|
|
||||||
return new File(basedir,path).getAbsolutePath();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,11 +6,9 @@ import junit.framework.TestSuite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit test for simple App.
|
* Unit test for simple App.
|
||||||
*
|
|
||||||
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
|
|
||||||
*/
|
*/
|
||||||
public class AppTest
|
public class AppTest
|
||||||
extends AbstractTestCase
|
extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create the test case
|
* Create the test case
|
||||||
|
@ -35,6 +33,6 @@ public class AppTest
|
||||||
*/
|
*/
|
||||||
public void testApp()
|
public void testApp()
|
||||||
{
|
{
|
||||||
assertEquals( "maven kicks ass", "maven kicks ass" );
|
assertTrue( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<model>
|
<model>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-archetypes</artifactId>
|
<artifactId>maven-archetypes</artifactId>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven.archetypes</groupId>
|
||||||
<version>1.0-alpha-1-SNAPSHOT</version>
|
<version>1.0-alpha-1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
|
@ -2,22 +2,25 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>${groupId}</groupId>
|
<groupId>${groupId}</groupId>
|
||||||
<artifactId>${artifactId}</artifactId>
|
<artifactId>${artifactId}</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>war</packaging>
|
||||||
<version>${version}</version>
|
<version>${version}</version>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<type>jar</type>
|
<scope>test</scope>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<plugins>
|
||||||
<resource>
|
<plugin>
|
||||||
<directory>src/main/webapp</directory>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
</resource>
|
<version>1.0-alpha-1</version>
|
||||||
</resources>
|
<configuration>
|
||||||
|
<warName>${artifactId}</warName>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</model>
|
</model>
|
|
@ -5,7 +5,13 @@
|
||||||
<version>1.0-alpha-1-SNAPSHOT</version>
|
<version>1.0-alpha-1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.apache.maven.archetypes</groupId>
|
||||||
<artifactId>maven-archetypes</artifactId>
|
<artifactId>maven-archetypes</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.0-alpha-1-SNAPSHOT</version>
|
<version>1.0-alpha-1-SNAPSHOT</version>
|
||||||
|
<modules>
|
||||||
|
<module>maven-archetype-mojo</module>
|
||||||
|
<module>maven-archetype-quickstart</module>
|
||||||
|
<module>maven-archetype-webapp</module>
|
||||||
|
</modules>
|
||||||
</model>
|
</model>
|
||||||
|
|
|
@ -8,4 +8,9 @@
|
||||||
<artifactId>maven-archetype</artifactId>
|
<artifactId>maven-archetype</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.0-alpha-1-SNAPSHOT</version>
|
<version>1.0-alpha-1-SNAPSHOT</version>
|
||||||
|
<modules>
|
||||||
|
<module>maven-archetype-core</module>
|
||||||
|
<module>maven-archetype-plugin</module>
|
||||||
|
<module>maven-archetypes</module>
|
||||||
|
</modules>
|
||||||
</model>
|
</model>
|
||||||
|
|
Loading…
Reference in New Issue