You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/06/07 21:45:21 UTC
svn commit: r782444 - in /maven/plugins/trunk/maven-ant-plugin/src:
it/ear-it/ it/ear-it/primary-source/src/ it/ear-it/primary-source/src/main/
it/ear-it/primary-source/src/main/java/
it/ear-it/primary-source/src/main/java/test/ it/ear-it/projects/logg...
Author: bentmann
Date: Sun Jun 7 19:45:20 2009
New Revision: 782444
URL: http://svn.apache.org/viewvc?rev=782444&view=rev
Log:
[MANT-50] Wrong build.classpath with reactor mode
Added:
maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/primary-source/src/
maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/primary-source/src/main/
maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/primary-source/src/main/java/
maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/primary-source/src/main/java/test/
maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/primary-source/src/main/java/test/ExtendedLog.java (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/projects/logging/src/
maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/projects/logging/src/main/
maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/projects/logging/src/main/java/
maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/projects/logging/src/main/java/test/
maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/projects/logging/src/main/java/test/Log.java (with props)
Modified:
maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/pom.xml
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/ArtifactResolverWrapper.java
Modified: maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/pom.xml?rev=782444&r1=782443&r2=782444&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/pom.xml (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/pom.xml Sun Jun 7 19:45:20 2009
@@ -36,6 +36,10 @@
<module>ear</module>
</modules>
+ <properties>
+ <build.compiler>extJavac</build.compiler>
+ </properties>
+
<build>
<plugins>
<plugin>
Added: maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/primary-source/src/main/java/test/ExtendedLog.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/primary-source/src/main/java/test/ExtendedLog.java?rev=782444&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/primary-source/src/main/java/test/ExtendedLog.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/primary-source/src/main/java/test/ExtendedLog.java Sun Jun 7 19:45:20 2009
@@ -0,0 +1,5 @@
+package test;
+
+public class ExtendedLog extends Log
+{
+}
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/primary-source/src/main/java/test/ExtendedLog.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/primary-source/src/main/java/test/ExtendedLog.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/projects/logging/src/main/java/test/Log.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/projects/logging/src/main/java/test/Log.java?rev=782444&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/projects/logging/src/main/java/test/Log.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/projects/logging/src/main/java/test/Log.java Sun Jun 7 19:45:20 2009
@@ -0,0 +1,5 @@
+package test;
+
+public class Log
+{
+}
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/projects/logging/src/main/java/test/Log.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/ear-it/projects/logging/src/main/java/test/Log.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java?rev=782444&r1=782443&r2=782444&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java Sun Jun 7 19:45:20 2009
@@ -591,8 +591,9 @@
for ( Iterator i = project.getCompileArtifacts().iterator(); i.hasNext(); )
{
Artifact artifact = (Artifact) i.next();
+ String path = artifactResolverWrapper.getLocalArtifactPath( artifact );
writer.startElement( "include" );
- writer.addAttribute( "name", AntBuildWriterUtil.toRelative( localRepository, artifact.getFile().getPath() ) );
+ writer.addAttribute( "name", path );
writer.endElement(); // include
}
}
@@ -614,8 +615,9 @@
for ( Iterator i = project.getTestArtifacts().iterator(); i.hasNext(); )
{
Artifact artifact = (Artifact) i.next();
+ String path = artifactResolverWrapper.getLocalArtifactPath( artifact );
writer.startElement( "include" );
- writer.addAttribute( "name", AntBuildWriterUtil.toRelative( localRepository, artifact.getFile().getPath() ) );
+ writer.addAttribute( "name", path );
writer.endElement(); // include
}
}
@@ -1047,12 +1049,12 @@
}
else if ( AntBuildWriterUtil.isEarPackaging( project ) )
{
- AntBuildWriterUtil.writeEarTask( writer, project, localRepository );
+ AntBuildWriterUtil.writeEarTask( writer, project, artifactResolverWrapper );
synonym = "ear";
}
else if ( AntBuildWriterUtil.isWarPackaging( project ) )
{
- AntBuildWriterUtil.writeWarTask( writer, project, localRepository );
+ AntBuildWriterUtil.writeWarTask( writer, project, artifactResolverWrapper );
synonym = "war";
}
else
@@ -1260,7 +1262,7 @@
Artifact artifact = (Artifact) i.next();
// TODO: should the artifacthandler be used instead?
- String path = AntBuildWriterUtil.toRelative( localRepository, artifact.getFile().getPath() );
+ String path = artifactResolverWrapper.getLocalArtifactPath( artifact );
if ( !new File( path ).exists() )
{
Modified: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java?rev=782444&r1=782443&r2=782444&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java Sun Jun 7 19:45:20 2009
@@ -451,13 +451,14 @@
*
* @param writer not null
* @param project not null
- * @param localRepository not null
+ * @param artifactResolverWrapper not null
* @throws IOException if any
*/
- public static void writeEarTask( XMLWriter writer, MavenProject project, File localRepository )
+ public static void writeEarTask( XMLWriter writer, MavenProject project,
+ ArtifactResolverWrapper artifactResolverWrapper )
throws IOException
{
- writeCopyLib( writer, project, localRepository, "${maven.build.dir}/${maven.build.finalName}" );
+ writeCopyLib( writer, project, artifactResolverWrapper, "${maven.build.dir}/${maven.build.finalName}" );
writer.startElement( "ear" );
writer.addAttribute( "destfile", "${maven.build.dir}/${maven.build.finalName}.ear" );
@@ -489,10 +490,11 @@
*
* @param writer not null
* @param project not null
- * @param localRepository not null
+ * @param artifactResolverWrapper not null
* @throws IOException if any
*/
- public static void writeWarTask( XMLWriter writer, MavenProject project, File localRepository )
+ public static void writeWarTask( XMLWriter writer, MavenProject project,
+ ArtifactResolverWrapper artifactResolverWrapper )
throws IOException
{
String webXml =
@@ -502,7 +504,7 @@
webXml = webXml.substring( "${basedir}/".length() );
}
- writeCopyLib( writer, project, localRepository, "${maven.build.dir}/${maven.build.finalName}/WEB-INF/lib" );
+ writeCopyLib( writer, project, artifactResolverWrapper, "${maven.build.dir}/${maven.build.finalName}/WEB-INF/lib" );
writer.startElement( "war" );
writer.addAttribute( "destfile", "${maven.build.dir}/${maven.build.finalName}.war" );
@@ -1115,10 +1117,11 @@
*
* @param writer not null
* @param project not null
- * @param localRepository not null
+ * @param artifactResolverWrapper not null
* @param outputDir not null
*/
- private static void writeCopyLib( XMLWriter writer, MavenProject project, File localRepository, String outputDir )
+ private static void writeCopyLib( XMLWriter writer, MavenProject project,
+ ArtifactResolverWrapper artifactResolverWrapper, String outputDir )
{
writer.startElement( "mkdir" );
writer.addAttribute( "dir", outputDir );
@@ -1133,8 +1136,7 @@
if ( !artifact.getScope().equals( Artifact.SCOPE_PROVIDED )
&& !artifact.getScope().equals( Artifact.SCOPE_TEST ) )
{
- String path = artifact.getFile().getPath();
- path = toRelative( localRepository, path );
+ String path = artifactResolverWrapper.getLocalArtifactPath( artifact );
if ( !new File( path ).isAbsolute() )
{
path = "${maven.repo.local}/" + path;
Modified: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/ArtifactResolverWrapper.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/ArtifactResolverWrapper.java?rev=782444&r1=782443&r2=782444&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/ArtifactResolverWrapper.java (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/ArtifactResolverWrapper.java Sun Jun 7 19:45:20 2009
@@ -154,4 +154,23 @@
throw new IOException( "Unable to find artifact: " + groupId + ":" + artifactId + ":" + version );
}
}
+
+ /**
+ * Gets the path to the specified artifact relative to the local repository's base directory. Note that this method
+ * does not actually resolve the artifact, it merely calculates the path at which the artifact is or would be stored
+ * in the local repository.
+ *
+ * @param artifact The artifact whose path should be determined, must not be <code>null</code>.
+ * @return The path to the artifact, never <code>null</code>.
+ */
+ public String getLocalArtifactPath( Artifact artifact )
+ {
+ /*
+ * NOTE: Don't use Artifact.getFile() here because this method could return the path to a JAR from the build
+ * output, e.g. ".../target/some-0.1.jar". The other special case are system-scope artifacts that reside
+ * somewhere outside of the local repository.
+ */
+ return localRepository.pathOf( artifact );
+ }
+
}