You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2016/01/03 00:26:59 UTC
svn commit: r1722680 - in /maven/shared/trunk/maven-archiver/src:
main/java/org/apache/maven/archiver/ site/apt/examples/ site/xdoc/
Author: michaelo
Date: Sat Jan 2 23:26:58 2016
New Revision: 1722680
URL: http://svn.apache.org/viewvc?rev=1722680&view=rev
Log:
[MSHARED-296] Improve header of pom.properties
Aligned the header name in pom.properties to the one in MANIFEST.MF
Modified:
maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/ManifestConfiguration.java
maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiver.java
maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
maven/shared/trunk/maven-archiver/src/site/apt/examples/manifestEntries.apt
maven/shared/trunk/maven-archiver/src/site/apt/examples/manifestFile.apt
maven/shared/trunk/maven-archiver/src/site/xdoc/index.xml.vm
Modified: maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/ManifestConfiguration.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/ManifestConfiguration.java?rev=1722680&r1=1722679&r2=1722680&view=diff
==============================================================================
--- maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/ManifestConfiguration.java (original)
+++ maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/ManifestConfiguration.java Sat Jan 2 23:26:58 2016
@@ -71,9 +71,9 @@ public class ManifestConfiguration
private boolean addDefaultImplementationEntries;
/**
- * The generated Class-Path entry will contains paths that follow the Maven 2 repository layout:
+ * The created Class-Path entry will contains paths that follow the Maven 2 repository layout:
* $groupId[0]/../${groupId[n]/$artifactId/$version/{fileName}
- *
+ *
* @since 2.3
* @deprecated Use {@link ManifestConfiguration#classpathLayoutType} instead.
*/
@@ -180,7 +180,7 @@ public class ManifestConfiguration
* @deprecated Use {@link ManifestConfiguration#setClasspathLayoutType(String)}, and use
* CLASSPATH_LAYOUT_TYPE_SIMPLE, CLASSPATH_LAYOUT_TYPE_CUSTOM, or CLASSPATH_LAYOUT_TYPE_REPOSITORY, also
* declared in {@link ManifestConfiguration}.
- * @param classpathMavenRepositoryLayout true/false classpath maven repository
+ * @param classpathMavenRepositoryLayout true/false classpath maven repository
*/
public void setClasspathMavenRepositoryLayout( boolean classpathMavenRepositoryLayout )
{
@@ -292,12 +292,12 @@ public class ManifestConfiguration
}
/**
- * Retrieve the flag for whether snapshot artifacts should be added to the classpath using the
- * timestamp/buildnumber version (the default, when this flag is true), or using the generic
+ * Retrieve the flag for whether snapshot artifacts should be added to the classpath using the
+ * timestamp/buildnumber version (the default, when this flag is true), or using the generic
* -SNAPSHOT version (when the flag is false). <br/>
- * <b>NOTE:</b> If the snapshot was installed locally, this flag will not have an effect on
+ * <b>NOTE:</b> If the snapshot was installed locally, this flag will not have an effect on
* that artifact's inclusion, since it will have the same version either way (i.e. -SNAPSHOT naming).
- *
+ *
* @return The state of {@link #useUniqueVersions}
*/
public boolean isUseUniqueVersions()
Modified: maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiver.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiver.java?rev=1722680&r1=1722679&r2=1722680&view=diff
==============================================================================
--- maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiver.java (original)
+++ maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiver.java Sat Jan 2 23:26:58 2016
@@ -125,7 +125,7 @@ public class MavenArchiver
if ( key.equals( "Class-Path" ) && attr != null )
{
// Merge the user-supplied Class-Path value with the programmatically
- // generated Class-Path. Note that the user-supplied value goes first
+ // created Class-Path. Note that the user-supplied value goes first
// so that resources there will override any in the standard Class-Path.
attr.setValue( value + " " + attr.getValue() );
}
@@ -328,7 +328,7 @@ public class MavenArchiver
else if ( ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_REPOSITORY.equals( layoutType ) )
{
// we use layout /$groupId[0]/../${groupId[n]/$artifactId/$version/{fileName}
- // here we must find the Artifact in the project Artifacts to generate the maven layout
+ // here we must find the Artifact in the project Artifacts to create the maven layout
if ( config.isUseUniqueVersions() )
{
classpath.append( interpolator.interpolate( REPOSITORY_LAYOUT,
@@ -579,7 +579,7 @@ public class MavenArchiver
File dir = new File( workingProject.getBuild().getDirectory(), "maven-archiver" );
pomPropertiesFile = new File( dir, "pom.properties" );
}
- new PomPropertiesUtil().createPomProperties( workingProject, archiver, pomPropertiesFile, forced );
+ new PomPropertiesUtil().createPomProperties( session, workingProject, archiver, pomPropertiesFile, forced );
}
// ----------------------------------------------------------------------
Modified: maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java?rev=1722680&r1=1722679&r2=1722680&view=diff
==============================================================================
--- maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java (original)
+++ maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java Sat Jan 2 23:26:58 2016
@@ -27,6 +27,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;
+import org.apache.maven.execution.MavenSession;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.archiver.Archiver;
import org.codehaus.plexus.archiver.ArchiverException;
@@ -34,12 +35,12 @@ import org.apache.maven.shared.utils.io.
/**
* This class is responsible for creating the pom.properties file.
- *
+ *
* @version $Id$
*/
public class PomPropertiesUtil
{
- private static final String GENERATED_BY_MAVEN = "Generated by Apache Maven";
+ private static final String CREATED_BY_MAVEN = "Created by Apache Maven";
private boolean sameContents( Properties props, File file )
throws IOException
@@ -68,7 +69,8 @@ public class PomPropertiesUtil
}
}
- private void createPropertyFile( Properties properties, File outputFile, boolean forceCreation )
+ private void createPropertiesFile( MavenSession session, Properties properties, File outputFile,
+ boolean forceCreation )
throws IOException
{
File outputDir = outputFile.getParentFile();
@@ -83,7 +85,17 @@ public class PomPropertiesUtil
OutputStream os = new FileOutputStream( outputFile );
try
{
- properties.store( os, GENERATED_BY_MAVEN );
+ String createdBy = CREATED_BY_MAVEN;
+ if ( session != null ) // can be null due to API backwards compatibility
+ {
+ String mavenVersion = session.getUserProperties().getProperty( "maven.version" );
+ if ( mavenVersion != null )
+ {
+ createdBy += " " + mavenVersion;
+ }
+ }
+
+ properties.store( os, createdBy );
os.close(); // stream is flushed but not closed by Properties.store()
os = null;
}
@@ -95,6 +107,7 @@ public class PomPropertiesUtil
/**
* Creates the pom.properties file.
+ * @param session TODO
* @param project {@link MavenProject}
* @param archiver {@link Archiver}
* @param pomPropertiesFile The pom properties file.
@@ -102,8 +115,8 @@ public class PomPropertiesUtil
* @throws ArchiverException archiver exception.
* @throws IOException IO exception.
*/
- public void createPomProperties( MavenProject project, Archiver archiver, File pomPropertiesFile,
- boolean forceCreation )
+ public void createPomProperties( MavenSession session, MavenProject project, Archiver archiver,
+ File pomPropertiesFile, boolean forceCreation )
throws ArchiverException, IOException
{
final String artifactId = project.getArtifactId();
@@ -117,7 +130,7 @@ public class PomPropertiesUtil
p.setProperty( "version", project.getVersion() );
- createPropertyFile( p, pomPropertiesFile, forceCreation );
+ createPropertiesFile( session, p, pomPropertiesFile, forceCreation );
archiver.addFile( pomPropertiesFile, "META-INF/maven/" + groupId + "/" + artifactId + "/pom.properties" );
}
Modified: maven/shared/trunk/maven-archiver/src/site/apt/examples/manifestEntries.apt
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-archiver/src/site/apt/examples/manifestEntries.apt?rev=1722680&r1=1722679&r2=1722680&view=diff
==============================================================================
--- maven/shared/trunk/maven-archiver/src/site/apt/examples/manifestEntries.apt (original)
+++ maven/shared/trunk/maven-archiver/src/site/apt/examples/manifestEntries.apt Sat Jan 2 23:26:58 2016
@@ -28,13 +28,13 @@ Manifest Entries
If you find that the other configuration options for Maven Archiver are not
enough for manipulating the manifest, you can add your own entries to it.
This is done with the <<<\<manifestEntries\>>>> configuration element.
-
+
In this example we'll add some entries to the manifest by specifying what we'd
like in the <<<\<configuration\>>>>/<<<\<archive\>>>> element of
maven-jar-plugin.
<<Note:>> As with all the examples here, this configuration can be used in all
- plugins that use Maven Archiver, not just maven-jar-plugin as in this example.
+ plugins that use Maven Archiver, not just maven-jar-plugin as in this example.
+-----+
<project>
@@ -64,7 +64,7 @@ Manifest Entries
As you see above you can use literal values or you can have values from the
POM interpolated into literals or simply use straight POM expressions. So this
- is what your resultant manifest will look like inside the generated jar:
+ is what your resultant manifest will look like inside the created jar:
+-----+
Manifest-Version: 1.0
Modified: maven/shared/trunk/maven-archiver/src/site/apt/examples/manifestFile.apt
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-archiver/src/site/apt/examples/manifestFile.apt?rev=1722680&r1=1722679&r2=1722680&view=diff
==============================================================================
--- maven/shared/trunk/maven-archiver/src/site/apt/examples/manifestFile.apt (original)
+++ maven/shared/trunk/maven-archiver/src/site/apt/examples/manifestFile.apt Sat Jan 2 23:26:58 2016
@@ -25,15 +25,15 @@
Use Your Own Manifest File
- By default, Maven Archiver generates the manifest file for you. It is
+ By default, Maven Archiver creates the manifest file for you. It is
sometimes useful to use your own hand crafted manifest file. Say that you
want to use the manifest file <<<src/main/resources/META-INF/MANIFEST.MF>>>.
This is done with the <<<\<manifestFile\>>>> configuration element by setting
the value to the location of your file.
The content of your own manifest file will be merged with the entries
- generated by Maven Archiver. If you specify an entry in your own manifest file
- it will override the value generated by Maven Archiver.
+ created by Maven Archiver. If you specify an entry in your own manifest file
+ it will override the value created by Maven Archiver.
<<Note:>> As with all the examples here, this configuration can be used in all
plugins that use Maven Archiver, not just maven-jar-plugin as in this example.
Modified: maven/shared/trunk/maven-archiver/src/site/xdoc/index.xml.vm
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-archiver/src/site/xdoc/index.xml.vm?rev=1722680&r1=1722679&r2=1722680&view=diff
==============================================================================
--- maven/shared/trunk/maven-archiver/src/site/xdoc/index.xml.vm (original)
+++ maven/shared/trunk/maven-archiver/src/site/xdoc/index.xml.vm Sat Jan 2 23:26:58 2016
@@ -80,7 +80,7 @@
<tr>
<td>addMavenDescriptor</td>
<td>
- Whether the generated archive will contain these two Maven files:
+ Whether the created archive will contain these two Maven files:
<ul>
<li>
The pom file, located in the archive in
@@ -129,7 +129,7 @@
<tr>
<td>index</td>
<td>
- Whether the generated archive will contain an
+ Whether the created archive will contain an
<code>INDEX.LIST</code> file.
The default value is <code>false</code>.
</td>
@@ -163,7 +163,7 @@
<tr>
<td>pomPropertiesFile</td>
<td>
- Use this to override the auto generated
+ Use this to override the auto created
<a href="#pom-properties-content">pom.properties</a> file
(only if <code>addMavenDescriptor</code> is set to <code>true</code>)
</td>
@@ -185,7 +185,7 @@
<tr>
<td>addClasspath</td>
<td>
- Whether to generate a <code>Class-Path</code> manifest entry.
+ Whether to create a <code>Class-Path</code> manifest entry.
The default value is <code>false</code>.
</td>
<td>boolean</td>
@@ -224,7 +224,7 @@ Specification-Vendor: \${project.organiz
<tr>
<td>addExtensions</td>
<td>
- Whether to generate an <code>Extension-List</code> manifest
+ Whether to create an <code>Extension-List</code> manifest
entry.
The default value is <code>false</code>.
</td>
@@ -234,7 +234,7 @@ Specification-Vendor: \${project.organiz
<tr>
<td>classpathLayoutType</td>
<td>
- The type of layout to use when formatting entries in the generated
+ The type of layout to use when formatting entries in the created
<code>Class-Path</code>. Valid values are: <code>simple</code>,
<code>repository</code> (the same as a Maven classpath layout) and
<code>custom</code>.
@@ -249,7 +249,7 @@ Specification-Vendor: \${project.organiz
<tr>
<td>classpathMavenRepositoryLayout</td>
<td>
- The generated <code>Class-Path</code> entry will contain paths
+ The created <code>Class-Path</code> entry will contain paths
that follow the Maven 2 repository layout:
<code>${groupId}/${artifactId}/${version}/${fileName}</code>.
The default value is <code>false</code>.
@@ -337,7 +337,7 @@ Specification-Vendor: \${project.organiz
<a name="pom-properties-content"/>
<subsection name="pom.properties content">
<p>
- The auto generated <code>pom.properties</code> file will contain the
+ The auto created <code>pom.properties</code> file will contain the
following content:
</p>
<source>