Skip to content

Commit b1dd894

Browse files
committed
[MSHARED-661] Remove manifest entry "Built-By" for reproducible builds
1 parent fd45303 commit b1dd894

File tree

6 files changed

+37
-43
lines changed

6 files changed

+37
-43
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,6 @@ private void handleSpecificationEntries( MavenProject project, Map<String, Strin
507507
private void addCustomEntries( Manifest m, Map<String, String> entries, ManifestConfiguration config )
508508
throws ManifestException
509509
{
510-
addManifestAttribute( m, entries, "Built-By", System.getProperty( "user.name" ) );
511510
addManifestAttribute( m, entries, "Build-Jdk", System.getProperty( "java.version" ) );
512511

513512
/*

src/site/apt/examples/classpath.apt

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ Set Up The Classpath
2828
* {Contents}
2929

3030
* {{{Add}Add A Class-Path Entry To The Manifest}}
31-
31+
3232
* {{{Make}Make The Jar Executable}}
33-
33+
3434
* {{{Prefix}Altering The Classpath: Defining a Classpath Directory Prefix}}
35-
35+
3636
* {{{Repository}Altering The Classpath: Using a Maven Repository-Style Classpath}}
37-
37+
3838
* {{{Custom}Altering The Classpath: Using a Custom Classpath Format}}
39-
39+
4040
* {{{Snapshot}Handling Snapshot Versions}}
41-
41+
4242
[]
4343

4444
* {Add} A Class-Path Entry To The Manifest
@@ -90,7 +90,6 @@ Set Up The Classpath
9090
+-----+
9191
Manifest-Version: 1.0
9292
Created-By: Apache Maven ${maven.version}
93-
Built-By: ${user.name}
9493
Build-Jdk: ${java.version}
9594
Class-Path: plexus-utils-1.1.jar commons-lang-2.1.jar
9695
+-----+
@@ -149,7 +148,6 @@ Class-Path: plexus-utils-1.1.jar commons-lang-2.1.jar
149148
+-----+
150149
Manifest-Version: 1.0
151150
Created-By: Apache Maven ${maven.version}
152-
Built-By: ${user.name}
153151
Build-Jdk: ${java.version}
154152
Main-Class: fully.qualified.MainClass
155153
Class-Path: plexus-utils-1.1.jar commons-lang-2.1.jar
@@ -213,7 +211,7 @@ Class-Path: lib/plexus-utils-1.1.jar lib/commons-lang-2.1.jar
213211

214212
Occasionally, you may want to include a Maven repository-style directory structure in your
215213
archive. If you wish to reference the dependency archives within those directories in your
216-
manifest classpath, try using the <<<\<classpathLayoutType\>>>> element with a value of
214+
manifest classpath, try using the <<<\<classpathLayoutType\>>>> element with a value of
217215
<<<'repository'>>>, like this:
218216

219217
+-----+
@@ -230,7 +228,7 @@ Class-Path: lib/plexus-utils-1.1.jar lib/commons-lang-2.1.jar
230228
<addClasspath>true</addClasspath>
231229
<classpathPrefix>lib/</classpathPrefix>
232230
<classpathLayoutType>repository</classpathLayoutType>
233-
231+
234232
<!-- NOTE: Deprecated in version 2.4. Use 'classpathLayoutType' instead.
235233
<classpathMavenRepositoryLayout>true</classpathMavenRepositoryLayout>
236234
-->
@@ -258,7 +256,7 @@ Class-Path: lib/plexus-utils-1.1.jar lib/commons-lang-2.1.jar
258256
+-----+
259257

260258
<<Note:>> In version 2.3, this feature was available by setting the <<<\<classpathMavenRepositoryLayout\>>>>
261-
element to the value <<<true>>>. This configuration option has been *deprecated* in version 2.4,
259+
element to the value <<<true>>>. This configuration option has been *deprecated* in version 2.4,
262260
in favor of the more general <<<\<classpathLayoutType\>>>> element, where a value of <<<'repository'>>>
263261
will render the same behavior.
264262

@@ -276,7 +274,7 @@ Class-Path: lib/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar lib/co
276274

277275
At times, you may have dependency archives in a custom format within your own archive, one that doesn't
278276
conform to any of the above classpath layouts. If you wish to define a custom layout for dependency archives
279-
within your archive's manifest classpath, try using the <<<\<classpathLayoutType\>>>> element with a value of
277+
within your archive's manifest classpath, try using the <<<\<classpathLayoutType\>>>> element with a value of
280278
<<<'custom'>>>, along with the <<<\<customClasspathLayout\>>>> element, like this:
281279

282280
+-----+
@@ -315,35 +313,35 @@ Class-Path: lib/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar lib/co
315313
</project>
316314
+-----+
317315

318-
This classpath layout is a little more involved than the previous examples.
316+
This classpath layout is a little more involved than the previous examples.
319317
To understand how the value of the <<<\<customClasspathLayout\>>>> configuration
320-
is interpreted, it's useful to understand the rules applied when resolving
318+
is interpreted, it's useful to understand the rules applied when resolving
321319
expressions within the value:
322-
320+
323321
[[1]] If present, trim off the prefix 'artifact.' from the expression.
324-
325-
[[2]] Attempt to resolve the expression as a reference to the Artifact using
326-
reflection (eg. <<<'artifactId'>>> becomes a reference to the method
322+
323+
[[2]] Attempt to resolve the expression as a reference to the Artifact using
324+
reflection (eg. <<<'artifactId'>>> becomes a reference to the method
327325
<<<'getArtifactId()'>>>).
328-
329-
[[3]] Attempt to resolve the expression as a reference to the ArtifactHandler of
326+
327+
[[3]] Attempt to resolve the expression as a reference to the ArtifactHandler of
330328
the current Artifact, again using reflection (eg. <<<'extension'>>> becomes a reference
331329
to the method <<<'getExtension()'>>>).
332-
333-
[[4]] Attempt to resolve the expression as a key in the special-case Properties instance,
330+
331+
[[4]] Attempt to resolve the expression as a key in the special-case Properties instance,
334332
which contains the following mappings:
335-
336-
* <<<'dashClassifier'>>>: If the Artifact has a classifier, this will be
337-
<<<'-${artifact.classifier}'>>>, otherwise this
333+
334+
* <<<'dashClassifier'>>>: If the Artifact has a classifier, this will be
335+
<<<'-${artifact.classifier}'>>>, otherwise this
338336
is an empty string.
339-
337+
340338
* <<<'dashClassifier?'>>>: This is a synonym of <<<'dashClassifier'>>>.
341-
342-
* <<<'groupIdPath'>>>: This is the equivalent of <<<'${artifact.groupId}'>>>,
339+
340+
* <<<'groupIdPath'>>>: This is the equivalent of <<<'${artifact.groupId}'>>>,
343341
with all <<<'.'>>> characters replaced by <<<'/'>>>.
344-
342+
345343
[]
346-
344+
347345
[]
348346

349347
The manifest classpath produced using the above configuration would look like this:
@@ -359,18 +357,18 @@ Class-Path: WEB-INF/lib/org/codehaus/plexus/plexus-utils-1.1.jar WEB-INF/lib/com
359357

360358
<(Since 2.4)>
361359

362-
Depending on how you construct your archive, you may have the ability to specify whether
360+
Depending on how you construct your archive, you may have the ability to specify whether
363361
snapshot dependency archives are included with the version suffix <<<'-SNAPSHOT'>>>, or
364362
whether the unique timestamp and build-number for that archive is used. For instance,
365363
the {{{/plugins/maven-assembly-plugin}Assembly Plugin}} allows
366-
you to make this decision in the <<<\<outputFileNameMapping\>>>> element of its
364+
you to make this decision in the <<<\<outputFileNameMapping\>>>> element of its
367365
<<<\<dependencySet>>>> descriptor section.
368-
366+
369367
** Forcing the use of -SNAPSHOT versions when using the simple (default) or repository classpath layout
370368

371369
To force the use of <<<'-SNAPSHOT'>>> version naming, simply disable the <<<\<useUniqueVersions\>>>>
372370
configuration element, like this:
373-
371+
374372
+-----+
375373
<useUniqueVersions>false</useUniqueVersions>
376374
+-----+
@@ -379,13 +377,13 @@ Class-Path: WEB-INF/lib/org/codehaus/plexus/plexus-utils-1.1.jar WEB-INF/lib/com
379377

380378
To force the use of <<<'-SNAPSHOT'>>> version naming, simply replace <<<'${artifact.version}'>>>
381379
with <<<'${artifact.baseVersion}'>>> in the custom layout example above, so it looks like this:
382-
380+
383381
+-----+
384382
<customClasspathLayout>WEB-INF/lib/${artifact.groupIdPath}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</customClasspathLayout>
385383
+-----+
386384

387385
The full example configuration would look like this:
388-
386+
389387
+-----+
390388
<project>
391389
...

src/site/apt/examples/manifest.apt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ Manifest
3333
+-----+
3434
Manifest-Version: 1.0
3535
Created-By: Apache Maven ${maven.version}
36-
Built-By: ${user.name}
3736
Build-Jdk: ${java.version}
3837
+-----+
3938

39+
<<Note:>> The <<<Build-Jdk>>> does not take toolchains configuration into account. It is the same
40+
JDK version as running the Maven instance.
41+
4042
* Adding Implementation And Specification Details
4143

4244
Starting with version 2.1, Maven Archiver no longer creates the
@@ -79,7 +81,6 @@ Build-Jdk: ${java.version}
7981
+-----+
8082
Manifest-Version: 1.0
8183
Created-By: Apache Maven ${maven.version}
82-
Built-By: ${user.name}
8384
Build-Jdk: ${java.version}
8485
Specification-Title: ${project.name}
8586
Specification-Version: ${project.artifact.selectedVersion.majorVersion}.${project.artifact.selectedVersion.minorVersion}

src/site/apt/examples/manifestEntries.apt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ Manifest Entries
6969
+-----+
7070
Manifest-Version: 1.0
7171
Created-By: Apache Maven ${maven.version}
72-
Built-By: ${user.name}
7372
Build-Jdk: ${java.version}
7473
mode: development
7574
url: http://some.url.org/

src/site/apt/examples/manifestSections.apt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ Manifest Sections
7575
+-----+
7676
Manifest-Version: 1.0
7777
Created-By: Apache Maven ${maven.version}
78-
Built-By: ${user.name}
7978
Build-Jdk: ${java.version}
8079

8180
Name: foo

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,6 @@ public void testDeprecatedCreateArchiveAPI()
500500
assertEquals( "Apache", manifest.get( Attributes.Name.IMPLEMENTATION_VENDOR ) );
501501

502502
assertEquals( System.getProperty( "java.version" ), manifest.get( new Attributes.Name( "Build-Jdk" ) ) );
503-
assertEquals( System.getProperty( "user.name" ), manifest.get( new Attributes.Name( "Built-By" ) ) );
504503
}
505504

506505
@Test
@@ -556,7 +555,6 @@ public void testManifestEntries()
556555
assertEquals( "org.apache.maven.archiver", manifest.getValue( "Automatic-Module-Name" ) );
557556

558557
assertEquals( System.getProperty( "java.version" ), manifest.get( new Attributes.Name( "Build-Jdk" ) ) );
559-
assertEquals( System.getProperty( "user.name" ), manifest.get( new Attributes.Name( "Built-By" ) ) );
560558

561559
assertTrue( StringUtils.isEmpty( manifest.getValue( new Attributes.Name( "keyWithEmptyValue" ) ) ) );
562560
assertTrue( manifest.containsKey( new Attributes.Name( "keyWithEmptyValue" ) ) );

0 commit comments

Comments
 (0)