PR: MNG-1088

if plugin is not built yet, go to the repository

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@306547 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-06 07:10:49 +00:00
parent 98d9d94424
commit 37f2a94bf2
15 changed files with 181 additions and 6 deletions

View File

@ -3,7 +3,7 @@
<parent>
<artifactId>maven-plugin-parent</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>2.0-beta-3-SNAPSHOT</version>
<version>2.0-beta-3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-core-it-plugin</artifactId>

View File

@ -117,7 +117,6 @@ it0040: Test the use of a packaging from a plugin
it0041: Test the use of a new type from a plugin
it0042: Test that the reactor can establish the artifact location of known projects for dependencies
First test generate sources to see that it works even when they aren't compiled
it0043: Test for repository inheritence - ensure using the same id overrides the defaults
@ -223,6 +222,9 @@ it0080: Test that depending on a WAR doesn't also get its dependencies
it0081: Test per-plugin dependencies.
it0082: Test that the reactor can establish the artifact location of known projects for dependencies
using process-sources to see that it works even when they aren't compiled
-------------------------------------------------------------------------------
- generated sources

View File

@ -1,3 +1,4 @@
it0082
it0081
it0080
it0079

View File

@ -1 +1 @@
generate-sources
package

View File

@ -0,0 +1 @@
test-component-c/target/my-test

View File

@ -0,0 +1 @@
process-sources

View File

@ -0,0 +1,13 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test-components</artifactId>
<version>0.1</version>
<name>Test Components</name>
<packaging>pom</packaging>
<modules>
<module>test-component-c</module>
<module>test-plugin</module>
</modules>
</project>

View File

@ -0,0 +1,41 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>test-components</artifactId>
<groupId>test</groupId>
<version>0.1</version>
</parent>
<groupId>test</groupId>
<artifactId>test-component-c</artifactId>
<version>0.1</version>
<name>Test Component C</name>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-core-it-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<goalItem>my-test</goalItem>
</configuration>
<executions>
<execution>
<goals>
<goal>touch</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>snapshots</id>
<name>Maven Central Plugins Development Repository</name>
<url>http://snapshots.maven.codehaus.org/maven2</url>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -0,0 +1,5 @@
public class C
extends A
{
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app >
</web-app>

View File

@ -0,0 +1,21 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>test-components</artifactId>
<groupId>test</groupId>
<version>0.1</version>
</parent>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-core-it-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.0-SNAPSHOT</version>
<name>Test Plugin</name>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0-beta-1</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,77 @@
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
*
* @phase process-sources
*
* @description Goal which cleans the build
*/
public class CoreItMojo
extends AbstractMojo
{
/**
* @parameter expression="${project.build.directory}"
* @required
*/
private String outputDirectory;
/**
* @parameter
* @required
*/
private String value;
public void execute()
throws MojoExecutionException
{
touch( new File( outputDirectory ), value );
}
private static void touch( File dir, String file )
throws MojoExecutionException
{
try
{
if ( !dir.exists() )
{
dir.mkdirs();
}
File touch = new File( dir, file );
FileWriter w = new FileWriter( touch );
w.write( file );
w.close();
}
catch ( IOException e )
{
throw new MojoExecutionException( "Error touching file", e );
}
}
}

View File

@ -13,7 +13,6 @@
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.0-beta-1</version>
<configuration>
<descriptor>src/assemble/bin.xml</descriptor>
<finalName>maven-${version}</finalName>

View File

@ -267,9 +267,18 @@ protected void addPlugin( Plugin plugin, Artifact pluginArtifact, MavenProject p
{
// TODO: if not matching, we should get the correct artifact from that project (attached)
if ( ref.getArtifact().getDependencyConflictId().equals( pluginArtifact.getDependencyConflictId() ) )
{
// if the project artifact doesn't exist, don't use it. We haven't built that far.
if ( project.getArtifact().getFile() != null && project.getArtifact().getFile().exists() )
{
pluginArtifact = new ActiveProjectArtifact( ref, pluginArtifact );
}
else
{
getLogger().warn( "Plugin found in the reactor has not been built when it's use was attempted" +
" - resolving from the repository instead" );
}
}
}
}

View File

@ -259,7 +259,7 @@ public boolean isRelease()
public void setRelease( boolean release )
{
artifact.setResolved( release );
artifact.setRelease( release );
}
public List getAvailableVersions()