o adding IT it0065

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@465839 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2006-10-19 20:47:22 +00:00
parent fdf99b5e33
commit 5fe647ba11
9 changed files with 225 additions and 0 deletions

View File

@ -0,0 +1,34 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.it</groupId>
<artifactId>maven-core-it0065</artifactId>
<version>1.0</version>
</parent>
<artifactId>maven-it0065-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0-beta-1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>central</id>
<name>Test Repository</name>
<url>file:/tmp/testRepo</url>
</repository>
</distributionManagement>
</project>

View File

@ -0,0 +1,76 @@
package org.apache.maven.plugin.coreit;
/*
* 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.
*/
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
/**
* @goal test-basedir
* @phase compile
*/
public class TestBasedirMojo
extends AbstractMojo
{
private static final int DELETE_RETRY_SLEEP_MILLIS = 10;
/**
* @parameter expression="${basedir}/target/child-basedir"
* @required
*/
private String childBasedir;
/**
* @parameter expression="${project.parent.basedir}/parent-basedir"
* @required
*/
private String parentBasedir;
public void execute()
throws MojoExecutionException
{
write( new File( childBasedir ) );
write( new File( parentBasedir ) );
}
private void write( File f )
throws MojoExecutionException
{
if ( !f.getParentFile().exists() )
{
f.getParentFile().mkdirs();
}
try
{
FileWriter w = new FileWriter( f );
w.write( f.getPath() );
w.close();
}
catch ( IOException e )
{
throw new MojoExecutionException( "Error writing verification file.", e );
}
}
}

View File

@ -0,0 +1,22 @@
<model>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.it</groupId>
<artifactId>maven-core-it0065</artifactId>
<description>Test that the basedir of the parent is set correctly.</description>
<packaging>pom</packaging>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<modules>
<module>plugin</module>
<module>subproject</module>
</modules>
</model>

View File

@ -0,0 +1,28 @@
<model>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.it</groupId>
<artifactId>maven-core-it0065</artifactId>
<version>1.0</version>
</parent>
<artifactId>maven-core-it0065-subproject</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.it</groupId>
<artifactId>maven-it0065-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>test-basedir</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</model>

View File

@ -0,0 +1,16 @@
package org.apache.maven.it0001;
public class Person
{
private String name;
public void setName( String name )
{
this.name = name;
}
public String getName()
{
return name;
}
}

View File

@ -0,0 +1,16 @@
package org.apache.maven.it0001;
import junit.framework.TestCase;
public class PersonTest
extends TestCase
{
public void testPerson()
{
Person person = new Person();
person.setName( "foo" );
assertEquals( "foo", person.getName() );
}
}

View File

@ -0,0 +1,16 @@
package org.apache.maven.it0001;
import junit.framework.TestCase;
public class PersonThreeTest
extends TestCase
{
public void testPerson()
{
Person person = new Person();
person.setName( "foo" );
assertEquals( "foo", person.getName() );
}
}

View File

@ -0,0 +1,16 @@
package org.apache.maven.it0001;
import junit.framework.TestCase;
public class PersonTwoTest
extends TestCase
{
public void testPerson()
{
Person person = new Person();
person.setName( "foo" );
assertEquals( "foo", person.getName() );
}
}