This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 162365a [MEAR-288] Check timestamp file name when removing JARs and
modifying manifest (#23)
162365a is described below
commit 162365aa6ae9589c445a3c12a4519f8725934d7f
Author: Marat Abrarov <[email protected]>
AuthorDate: Sun Oct 18 01:12:50 2020 +0300
[MEAR-288] Check timestamp file name when removing JARs and modifying
manifest (#23)
* [MEAR-288] - Check timestamp file name when removing JARs and modifying
manifest if JAR comes from SNAPSHOT dependency
* [MEAR-288] - Reduction of code duplication in test
* [MEAR-288] - Extended test for the case when SNAPSHOT dependency JAR is
included into WAR with SNAPSHOT version suffix
* [MEAR-288] - Raised version of Maven WAR Plugin used for integration
tests till the latest version.
---
pom.xml | 4 +-
.../war-module/pom.xml | 2 +-
.../filenamemapping-usage-fail/war-module/pom.xml | 2 +-
src/it/non-skinny-wars/war-module/pom.xml | 2 +-
.../war-module/pom.xml | 2 +-
.../war-module/pom.xml | 2 +-
src/it/skinny-wars-javaee5/war-module/pom.xml | 2 +-
src/it/skinny-wars-timestamp/ear-module/pom.xml | 8 +-
src/it/skinny-wars-timestamp/pom.xml | 6 +-
src/it/skinny-wars-timestamp/verify.bsh | 136 +++++++++++++--------
.../{war-module => war-module-one}/pom.xml | 12 +-
.../src/main/webapp/WEB-INF/web.xml | 0
.../{war-module => war-module-two}/pom.xml | 19 +--
.../src/main/webapp/WEB-INF/web.xml | 0
src/it/skinny-wars/war-module/pom.xml | 2 +-
.../java/org/apache/maven/plugins/ear/EarMojo.java | 54 +++++++-
16 files changed, 176 insertions(+), 77 deletions(-)
diff --git a/pom.xml b/pom.xml
index ac06435..56524e9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,12 +86,13 @@
<javaVersion>7</javaVersion>
<surefire.version>2.22.2</surefire.version>
<project.build.outputTimestamp>2020-09-26T20:10:30Z</project.build.outputTimestamp>
- <mavenWarPluginVersion>2.1.1</mavenWarPluginVersion>
+ <mavenWarPluginVersion>3.3.1</mavenWarPluginVersion>
<mavenCompilerPluginVersion>2.5.1</mavenCompilerPluginVersion>
<mavenEjbPluginVersion>2.3</mavenEjbPluginVersion>
<invoker.skip>false</invoker.skip>
<invoker.install.skip>${invoker.skip}</invoker.install.skip>
<invoker.it.skip>${invoker.skip}</invoker.it.skip>
+ <invoker.cloneClean>true</invoker.cloneClean>
</properties>
<dependencies>
@@ -289,6 +290,7 @@
</extraArtifacts>
<skipInstallation>${invoker.install.skip}</skipInstallation>
<skipInvocation>${invoker.it.skip}</skipInvocation>
+ <cloneClean>${invoker.cloneClean}</cloneClean>
</configuration>
</plugin>
<plugin>
diff --git a/src/it/MEAR-243-skinny-wars-provided/war-module/pom.xml
b/src/it/MEAR-243-skinny-wars-provided/war-module/pom.xml
index c6be50e..9604026 100644
--- a/src/it/MEAR-243-skinny-wars-provided/war-module/pom.xml
+++ b/src/it/MEAR-243-skinny-wars-provided/war-module/pom.xml
@@ -40,7 +40,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
+ <version>@mavenWarPluginVersion@</version>
</plugin>
</plugins>
</build>
diff --git a/src/it/filenamemapping-usage-fail/war-module/pom.xml
b/src/it/filenamemapping-usage-fail/war-module/pom.xml
index c6be50e..9604026 100644
--- a/src/it/filenamemapping-usage-fail/war-module/pom.xml
+++ b/src/it/filenamemapping-usage-fail/war-module/pom.xml
@@ -40,7 +40,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
+ <version>@mavenWarPluginVersion@</version>
</plugin>
</plugins>
</build>
diff --git a/src/it/non-skinny-wars/war-module/pom.xml
b/src/it/non-skinny-wars/war-module/pom.xml
index 10c4b6c..58254c1 100644
--- a/src/it/non-skinny-wars/war-module/pom.xml
+++ b/src/it/non-skinny-wars/war-module/pom.xml
@@ -40,7 +40,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
+ <version>@mavenWarPluginVersion@</version>
</plugin>
</plugins>
</build>
diff --git a/src/it/skinny-wars-filenamemapping-full/war-module/pom.xml
b/src/it/skinny-wars-filenamemapping-full/war-module/pom.xml
index c6be50e..9604026 100644
--- a/src/it/skinny-wars-filenamemapping-full/war-module/pom.xml
+++ b/src/it/skinny-wars-filenamemapping-full/war-module/pom.xml
@@ -40,7 +40,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
+ <version>@mavenWarPluginVersion@</version>
</plugin>
</plugins>
</build>
diff --git a/src/it/skinny-wars-filenamemapping-no-version/war-module/pom.xml
b/src/it/skinny-wars-filenamemapping-no-version/war-module/pom.xml
index c6be50e..9604026 100644
--- a/src/it/skinny-wars-filenamemapping-no-version/war-module/pom.xml
+++ b/src/it/skinny-wars-filenamemapping-no-version/war-module/pom.xml
@@ -40,7 +40,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
+ <version>@mavenWarPluginVersion@</version>
</plugin>
</plugins>
</build>
diff --git a/src/it/skinny-wars-javaee5/war-module/pom.xml
b/src/it/skinny-wars-javaee5/war-module/pom.xml
index ab808a3..9604026 100644
--- a/src/it/skinny-wars-javaee5/war-module/pom.xml
+++ b/src/it/skinny-wars-javaee5/war-module/pom.xml
@@ -40,7 +40,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
- <version>3.1.0</version>
+ <version>@mavenWarPluginVersion@</version>
</plugin>
</plugins>
</build>
diff --git a/src/it/skinny-wars-timestamp/ear-module/pom.xml
b/src/it/skinny-wars-timestamp/ear-module/pom.xml
index 7da0166..f279c71 100644
--- a/src/it/skinny-wars-timestamp/ear-module/pom.xml
+++ b/src/it/skinny-wars-timestamp/ear-module/pom.xml
@@ -40,7 +40,13 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven.its.ear.skinnywars</groupId>
- <artifactId>war-module</artifactId>
+ <artifactId>war-module-one</artifactId>
+ <version>1.0</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+ <artifactId>war-module-two</artifactId>
<version>1.0</version>
<type>war</type>
</dependency>
diff --git a/src/it/skinny-wars-timestamp/pom.xml
b/src/it/skinny-wars-timestamp/pom.xml
index b1c8946..4980a14 100644
--- a/src/it/skinny-wars-timestamp/pom.xml
+++ b/src/it/skinny-wars-timestamp/pom.xml
@@ -30,8 +30,8 @@ under the License.
<description>Test Skinny WAR generation</description>
<modules>
- <module>ear-module</module>
- <module>war-module</module>
+ <module>ear-module</module>
+ <module>war-module-one</module>
+ <module>war-module-two</module>
</modules>
-
</project>
diff --git a/src/it/skinny-wars-timestamp/verify.bsh
b/src/it/skinny-wars-timestamp/verify.bsh
index f9a7270..3b9307d 100644
--- a/src/it/skinny-wars-timestamp/verify.bsh
+++ b/src/it/skinny-wars-timestamp/verify.bsh
@@ -20,78 +20,108 @@
import java.io.*;
import java.util.*;
import java.util.jar.*;
-import java.util.regex.*;
-File jarFile = new File( basedir,
"ear-module/target/ear-module-1.0/org.apache.maven.its.ear.skinnywars-war-module-1.0.war"
);
-System.out.println( "Checking for existence of " + jarFile );
-if ( !jarFile.isFile() )
+assertFileExists( File file )
{
- throw new IllegalStateException( "Missing file: " + jarFile );
+ System.out.println( "Checking for existence of " + file );
+ if ( !file.isFile() )
+ {
+ throw new IllegalStateException( "Missing file: " + file );
+ }
}
-JarFile jar = new JarFile( jarFile );
-
-String[] includedEntries = {
- "WEB-INF/web.xml",
- "META-INF/MANIFEST.MF"
-};
-for ( String included : includedEntries )
+assertIncludes( File file, String[] includedEntries )
{
- System.out.println( "Checking for included archive entry " + included );
- if ( jar.getEntry( included ) == null )
+ JarFile jar = new JarFile( file );
+ try
+ {
+ for ( String included : includedEntries )
+ {
+ System.out.println( "Checking for included archive entry " +
included );
+ if ( jar.getEntry( included ) == null )
+ {
+ throw new IllegalStateException( "Missing archive entry: " +
included );
+ }
+ }
+ }
+ finally
{
- throw new IllegalStateException( "Missing archive entry: " + included
);
+ jar.close();
}
}
-Manifest manifest = jar.getManifest();
-String manifestClassPath = manifest.getMainAttributes().getValue("Class-Path");
-System.out.println( "manifestClassPath: " + manifestClassPath );
-if ( !manifestClassPath.equals("commons-lang-commons-lang-2.5.jar
eartest-jar-sample-one-1.0-20150825.210557-91.jar") )
+assertExcludes( File file, String[] excludedEntries )
{
- throw new IllegalStateException( "Missing entry in war MANIFEST.MF:
commons-lang-commons-lang-2.5.jar
eartest-jar-sample-one-1.0-20150825.210557-91.jar");
+ JarFile jar = new JarFile( file );
+ try
+ {
+ for ( String excluded : excludedEntries )
+ {
+ System.out.println( "Checking for excluded artifact " + excluded );
+ if ( jar.getEntry( excluded ) != null )
+ {
+ throw new IllegalStateException( "Archive entry should be
excluded: " + excluded );
+ }
+ }
+ }
+ finally
+ {
+ jar.close();
+ }
}
-String[] excludedEntries = {
- "WEB-INF/lib/commons-lang-2.5.jar",
- "WEB-INF/lib/jar-sample-one-1.0-SNAPSHOT.jar"
-};
-for ( String excluded : excludedEntries )
+assertManifestClassPath( File file, String classPath )
{
- System.out.println( "Checking for excluded artifact " + excluded );
- if ( jar.getEntry( excluded ) != null )
+ JarFile jar = new JarFile( file );
+ try
{
- throw new IllegalStateException( "Archive entry should be excluded: "
+ excluded );
+ Manifest manifest = jar.getManifest();
+ String manifestClassPath = manifest.getMainAttributes().getValue(
"Class-Path" );
+ System.out.println( "manifestClassPath: " + manifestClassPath );
+ if ( !( classPath == null && manifestClassPath == null
+ || manifestClassPath != null && manifestClassPath.equals(
classPath ) ) )
+ {
+ throw new IllegalStateException( "Missing entry in war
MANIFEST.MF: " + classPath );
+ }
+ }
+ finally
+ {
+ jar.close();
}
}
-jar.close();
-
-
-File jarFile = new File( basedir, "war-module/target/war-module-1.0.war" );
-System.out.println( "Checking for existence of " + jarFile );
-if ( !jarFile.isFile() )
-{
- throw new IllegalStateException( "Missing file: " + jarFile );
-}
+File warOneFile = new File( basedir,
"war-module-one/target/war-module-one-1.0.war" );
+assertFileExists( warOneFile );
+assertIncludes( warOneFile, new String[] { "WEB-INF/web.xml",
+ "META-INF/MANIFEST.MF",
+ "WEB-INF/lib/commons-lang-2.5.jar",
+
"WEB-INF/lib/jar-sample-one-1.0-20150825.210557-91.jar" } );
+assertManifestClassPath( warOneFile, "commons-lang-2.5.jar
jar-sample-one-1.0-20150825.210557-91.jar" );
-JarFile jar = new JarFile( jarFile );
+File warTwoFile = new File( basedir,
"war-module-two/target/war-module-two-1.0.war" );
+assertFileExists( warTwoFile );
+assertIncludes( warTwoFile, new String[] { "WEB-INF/web.xml",
+ "META-INF/MANIFEST.MF",
+
"WEB-INF/lib/jar-sample-one-1.0-SNAPSHOT.jar" } );
+assertExcludes( warTwoFile, new String[] { "WEB-INF/lib/commons-lang-2.5.jar"
} );
+assertManifestClassPath( warTwoFile, "jar-sample-one-1.0-SNAPSHOT.jar" );
-String[] includedEntries = {
- "WEB-INF/web.xml",
- "META-INF/MANIFEST.MF",
- "WEB-INF/lib/commons-lang-2.5.jar",
- "WEB-INF/lib/jar-sample-one-1.0-20150825.210557-91.jar"
-};
-for ( String included : includedEntries )
-{
- System.out.println( "Checking for included archive entry " + included );
- if ( jar.getEntry( included ) == null )
- {
- throw new IllegalStateException( "Missing archive entry: " + included
);
- }
-}
+File warModuleOneFile = new File( basedir,
"ear-module/target/ear-module-1.0/org.apache.maven.its.ear.skinnywars-war-module-one-1.0.war"
);
+assertFileExists( warModuleOneFile );
+assertIncludes( warModuleOneFile, new String[] { "WEB-INF/web.xml",
+ "META-INF/MANIFEST.MF" } );
+assertExcludes( warModuleOneFile, new String[] {
"WEB-INF/lib/commons-lang-2.5.jar",
+
"WEB-INF/lib/jar-sample-one-1.0-SNAPSHOT.jar",
+
"WEB-INF/lib/jar-sample-one-1.0-20150825.210557-91.jar" } );
+assertManifestClassPath( warModuleOneFile, "commons-lang-commons-lang-2.5.jar
eartest-jar-sample-one-1.0-20150825.210557-91.jar" );
-jar.close();
+File warModuleTwoFile = new File( basedir,
"ear-module/target/ear-module-1.0/org.apache.maven.its.ear.skinnywars-war-module-two-1.0.war"
);
+assertFileExists( warModuleTwoFile );
+assertIncludes( warModuleTwoFile, new String[] { "WEB-INF/web.xml",
+ "META-INF/MANIFEST.MF" } );
+assertExcludes( warModuleTwoFile, new String[] {
"WEB-INF/lib/commons-lang-2.5.jar",
+
"WEB-INF/lib/jar-sample-one-1.0-SNAPSHOT.jar",
+
"WEB-INF/lib/jar-sample-one-1.0-20150825.210557-91.jar" } );
+assertManifestClassPath( warModuleTwoFile,
"eartest-jar-sample-one-1.0-20150825.210557-91.jar
commons-lang-commons-lang-2.5.jar" );
return true;
diff --git a/src/it/skinny-wars-timestamp/war-module/pom.xml
b/src/it/skinny-wars-timestamp/war-module-one/pom.xml
similarity index 79%
copy from src/it/skinny-wars-timestamp/war-module/pom.xml
copy to src/it/skinny-wars-timestamp/war-module-one/pom.xml
index 82cce9e..553f3bc 100644
--- a/src/it/skinny-wars-timestamp/war-module/pom.xml
+++ b/src/it/skinny-wars-timestamp/war-module-one/pom.xml
@@ -23,7 +23,7 @@ under the License.
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.ear.skinnywars</groupId>
- <artifactId>war-module</artifactId>
+ <artifactId>war-module-one</artifactId>
<version>1.0</version>
<packaging>war</packaging>
@@ -45,7 +45,15 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
+ <version>@mavenWarPluginVersion@</version>
+ <configuration>
+
<outputFileNameMapping>@{artifactId}@-@{version}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
</plugin>
</plugins>
</build>
diff --git
a/src/it/skinny-wars-timestamp/war-module/src/main/webapp/WEB-INF/web.xml
b/src/it/skinny-wars-timestamp/war-module-one/src/main/webapp/WEB-INF/web.xml
similarity index 100%
copy from
src/it/skinny-wars-timestamp/war-module/src/main/webapp/WEB-INF/web.xml
copy to
src/it/skinny-wars-timestamp/war-module-one/src/main/webapp/WEB-INF/web.xml
diff --git a/src/it/skinny-wars-timestamp/war-module/pom.xml
b/src/it/skinny-wars-timestamp/war-module-two/pom.xml
similarity index 68%
rename from src/it/skinny-wars-timestamp/war-module/pom.xml
rename to src/it/skinny-wars-timestamp/war-module-two/pom.xml
index 82cce9e..b719677 100644
--- a/src/it/skinny-wars-timestamp/war-module/pom.xml
+++ b/src/it/skinny-wars-timestamp/war-module-two/pom.xml
@@ -23,17 +23,12 @@ under the License.
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.ear.skinnywars</groupId>
- <artifactId>war-module</artifactId>
+ <artifactId>war-module-two</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<dependencies>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.5</version>
- </dependency>
- <dependency>
<groupId>eartest</groupId>
<artifactId>jar-sample-one</artifactId>
<version>1.0-SNAPSHOT</version>
@@ -45,7 +40,17 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
+ <version>@mavenWarPluginVersion@</version>
+ <configuration>
+
<outputFileNameMapping>@{artifactId}@-@{baseVersion}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <classpathLayoutType>custom</classpathLayoutType>
+
<customClasspathLayout>$${artifact.artifactId}-$${artifact.baseVersion}$${dashClassifier?}.$${artifact.extension}</customClasspathLayout>
+ </manifest>
+ </archive>
+ </configuration>
</plugin>
</plugins>
</build>
diff --git
a/src/it/skinny-wars-timestamp/war-module/src/main/webapp/WEB-INF/web.xml
b/src/it/skinny-wars-timestamp/war-module-two/src/main/webapp/WEB-INF/web.xml
similarity index 100%
rename from
src/it/skinny-wars-timestamp/war-module/src/main/webapp/WEB-INF/web.xml
rename to
src/it/skinny-wars-timestamp/war-module-two/src/main/webapp/WEB-INF/web.xml
diff --git a/src/it/skinny-wars/war-module/pom.xml
b/src/it/skinny-wars/war-module/pom.xml
index c6be50e..9604026 100644
--- a/src/it/skinny-wars/war-module/pom.xml
+++ b/src/it/skinny-wars/war-module/pom.xml
@@ -40,7 +40,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
+ <version>@mavenWarPluginVersion@</version>
</plugin>
</plugins>
</build>
diff --git a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
index 3b7cd91..90571fa 100644
--- a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
@@ -40,6 +40,7 @@ import java.util.Objects;
import org.apache.maven.archiver.MavenArchiveConfiguration;
import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecutionException;
@@ -56,6 +57,7 @@ import org.apache.maven.shared.filtering.MavenFileFilter;
import org.apache.maven.shared.filtering.MavenFilteringException;
import org.apache.maven.shared.filtering.MavenResourcesExecution;
import org.apache.maven.shared.filtering.MavenResourcesFiltering;
+import org.apache.maven.shared.mapping.MappingUtils;
import org.apache.maven.shared.utils.io.FileUtils;
import org.codehaus.plexus.archiver.Archiver;
import org.codehaus.plexus.archiver.ArchiverException;
@@ -70,6 +72,7 @@ import
org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
import org.codehaus.plexus.archiver.zip.ZipArchiver;
import org.codehaus.plexus.archiver.zip.ZipUnArchiver;
import org.codehaus.plexus.components.io.filemappers.FileMapper;
+import org.codehaus.plexus.interpolation.InterpolationException;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.StringUtils;
@@ -85,6 +88,12 @@ public class EarMojo
extends AbstractEarMojo
{
/**
+ * Default file name mapping used by artifacts located in local repository.
+ */
+ private static final String ARTIFACT_DEFAULT_FILE_NAME_MAPPING =
+ "@{artifactId}@-@{version}@@{dashClassifier?}@.@{extension}@";
+
+ /**
* Single directory for extra files to include in the EAR.
*/
@Parameter( defaultValue = "${basedir}/src/main/application", required =
true )
@@ -819,14 +828,35 @@ public class EarMojo
{
getLog().debug( "module does not exist with original
file name." );
artifact = new File( workLibDir,
jm.getBundleFileName() );
- getLog().debug( "Artifact with mapping:" +
artifact.getAbsolutePath() );
+ getLog().debug( "Artifact with mapping: " +
artifact.getAbsolutePath() );
}
if ( !artifact.exists() )
{
getLog().debug( "Artifact with mapping does not
exist." );
artifact = new File( workLibDir,
jm.getArtifact().getFile().getName() );
- getLog().debug( "Artifact with original file name:" +
artifact.getAbsolutePath() );
+ getLog().debug( "Artifact with original file name: " +
artifact.getAbsolutePath() );
+ }
+
+ if ( !artifact.exists() )
+ {
+ getLog().debug( "Artifact with original file name does
not exist." );
+ final Artifact jmArtifact = jm.getArtifact();
+ if ( jmArtifact.isSnapshot() )
+ {
+ try
+ {
+ artifact = new File( workLibDir, MappingUtils
+ .evaluateFileNameMapping(
ARTIFACT_DEFAULT_FILE_NAME_MAPPING, jmArtifact ) );
+ getLog()
+ .debug( "Artifact with default mapping
file name: " + artifact.getAbsolutePath() );
+ }
+ catch ( InterpolationException e )
+ {
+ getLog().warn( "Failed to evaluate file name
for [" + jm + "] module using mapping: "
+ + ARTIFACT_DEFAULT_FILE_NAME_MAPPING );
+ }
+ }
}
if ( artifact.exists() )
@@ -969,11 +999,29 @@ public class EarMojo
{
return moduleClassPathIndex;
}
- moduleClassPathIndex = classPathElements.indexOf(
module.getArtifact().getFile().getName() );
+ final Artifact artifact = module.getArtifact();
+ moduleClassPathIndex = classPathElements.indexOf(
artifact.getFile().getName() );
if ( moduleClassPathIndex != -1 )
{
return moduleClassPathIndex;
}
+ if ( artifact.isSnapshot() )
+ {
+ try
+ {
+ moduleClassPathIndex = classPathElements
+ .indexOf( MappingUtils.evaluateFileNameMapping(
ARTIFACT_DEFAULT_FILE_NAME_MAPPING, artifact ) );
+ if ( moduleClassPathIndex != -1 )
+ {
+ return moduleClassPathIndex;
+ }
+ }
+ catch ( InterpolationException e )
+ {
+ getLog().warn( "Failed to evaluate file name for [" + module +
"] module using mapping: "
+ + ARTIFACT_DEFAULT_FILE_NAME_MAPPING );
+ }
+ }
return classPathElements.indexOf( module.getUri() );
}
}