Skip to content

Commit c16bda7

Browse files
committed
[MSHARED-588] User supplied Class-Path entry does not go first
1 parent b1dd894 commit c16bda7

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/main/java/org/apache/maven/archiver/MavenArchiver.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import java.util.Map;
4848
import java.util.Properties;
4949
import java.util.Set;
50+
import java.util.jar.Attributes;
5051

5152
/**
5253
* @author <a href="[email protected]">Emmanuel Venisse</a>
@@ -127,7 +128,7 @@ public Manifest getManifest( MavenSession session, MavenProject project, MavenAr
127128
String key = entry.getKey();
128129
String value = entry.getValue();
129130
Manifest.Attribute attr = manifest.getMainSection().getAttribute( key );
130-
if ( key.equals( "ClassPath" ) && attr != null )
131+
if ( key.equals( Attributes.Name.CLASS_PATH.toString() ) && attr != null )
131132
{
132133
// Merge the user-supplied Class-Path value with the programmatically
133134
// created Class-Path. Note that the user-supplied value goes first

src/test/java/org/apache/maven/archiver/MavenArchiverTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ public boolean isAddClasspath()
230230

231231
Manifest manifest = archiver.getManifest( session, project, archiveConfiguration );
232232
String classPath = manifest.getMainAttributes().getValue( "Class-Path" );
233-
assertTrue( "User specified Class-Path entry was not added to manifest", classPath.contains( "help/" ) );
234-
assertTrue( "Class-Path generated by addClasspath was not added to manifest",
235-
classPath.contains( tempFile.getName() ) );
233+
assertTrue( "User specified Class-Path entry was not prepended to manifest", classPath.startsWith( "help/" ) );
234+
assertTrue( "Class-Path generated by addClasspath was not appended to manifest",
235+
classPath.endsWith( tempFile.getName() ) );
236236
}
237237
finally
238238
{

0 commit comments

Comments
 (0)