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 2014/06/15 21:05:33 UTC
[1/2] git commit: [MNG-5647] ${maven.build.timestamp} uses incorrect
ISO datetime separator
Repository: maven
Updated Branches:
refs/heads/master 5c78a8d2f -> e9e8a2090
[MNG-5647] ${maven.build.timestamp} uses incorrect ISO datetime
separator
- Fully utilize extended ISO timestamp
- Added changes to index.apt
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/cdb8ad6d
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/cdb8ad6d
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/cdb8ad6d
Branch: refs/heads/master
Commit: cdb8ad6dd1ee5e24abede7ec22dce7a8197dbd1a
Parents: 5c78a8d
Author: Michael Osipov <mi...@apache.org>
Authored: Sun Jun 15 21:01:55 2014 +0200
Committer: Michael Osipov <mi...@apache.org>
Committed: Sun Jun 15 21:01:55 2014 +0200
----------------------------------------------------------------------
.../interpolation/MavenBuildTimestamp.java | 7 +-
maven-model-builder/src/site/apt/index.apt | 4 +-
.../AbstractModelInterpolatorTest.java | 75 ++++++++++++++------
.../interpolation/MavenBuildTimestampTest.java | 4 +-
4 files changed, 60 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/cdb8ad6d/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/MavenBuildTimestamp.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/MavenBuildTimestamp.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/MavenBuildTimestamp.java
index d342566..447f0ef 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/MavenBuildTimestamp.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/MavenBuildTimestamp.java
@@ -26,7 +26,8 @@ import java.util.TimeZone;
public class MavenBuildTimestamp
{
- public static final String DEFAULT_BUILD_TIMESTAMP_FORMAT = "yyyyMMdd-HHmm";
+ // ISO 8601-compliant timestamp for machine readability
+ public static final String DEFAULT_BUILD_TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
public static final String BUILD_TIMESTAMP_FORMAT_PROPERTY = "maven.build.timestamp.format";
@@ -35,8 +36,8 @@ public class MavenBuildTimestamp
public MavenBuildTimestamp()
{
this( new Date() );
- }
-
+ }
+
public MavenBuildTimestamp( Date time )
{
this( time, DEFAULT_BUILD_TIMESTAMP_FORMAT );
http://git-wip-us.apache.org/repos/asf/maven/blob/cdb8ad6d/maven-model-builder/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/site/apt/index.apt b/maven-model-builder/src/site/apt/index.apt
index b3d23fd..78e1b32 100644
--- a/maven-model-builder/src/site/apt/index.apt
+++ b/maven-model-builder/src/site/apt/index.apt
@@ -126,7 +126,7 @@ Maven Model Builder
<<<pom.baseUri>>> (<deprecated>) | the directory containing the <<<pom.xml>>> file as URI | <<<$\{project.baseUri\}>>> |
*----+------+------+
| <<<build.timestamp>>>\
-<<<maven.build.timestamp>>> | the timestamp of build start, in <<<yyyyMMdd-HHmm>>> default format, which can be overridden with <<<maven.build.timestamp.format>>> POM property | <<<$\{maven.build.timestamp\}>>> |
+<<<maven.build.timestamp>>> | the UTC timestamp of build start, in <<<yyyy-MM-dd'T'HH:mm:ss'Z'>>> default format, which can be overridden with <<<maven.build.timestamp.format>>> POM property | <<<$\{maven.build.timestamp\}>>> |
*----+------+------+
| <<<*>>> | user properties, set from CLI with <<<-Dproperty=value>>> | <<<$\{skipTests\}>>> |
*----+------+------+
@@ -166,4 +166,4 @@ Maven Model Builder
[]
- []
\ No newline at end of file
+ []
http://git-wip-us.apache.org/repos/asf/maven/blob/cdb8ad6d/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java
index 97c0715..99842df 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java
@@ -39,6 +39,7 @@ import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
+import java.util.TimeZone;
/**
* @author jdcasey
@@ -83,34 +84,62 @@ public abstract class AbstractModelInterpolatorTest
}
return config;
}
-
- public void testDefaultBuildTimestampFormatShouldParseTimeIn24HourFormat()
+
+ public void testDefaultBuildTimestampFormatShouldFormatTimeIn24HourFormat()
{
Calendar cal = Calendar.getInstance();
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
cal.set( Calendar.HOUR, 12 );
cal.set( Calendar.AM_PM, Calendar.AM );
-
+
// just to make sure all the bases are covered...
cal.set( Calendar.HOUR_OF_DAY, 0 );
cal.set( Calendar.MINUTE, 16 );
+ cal.set( Calendar.SECOND, 0 );
cal.set( Calendar.YEAR, 1976 );
cal.set( Calendar.MONTH, Calendar.NOVEMBER );
cal.set( Calendar.DATE, 11 );
-
+
Date firstTestDate = cal.getTime();
-
+
cal.set( Calendar.HOUR, 11 );
cal.set( Calendar.AM_PM, Calendar.PM );
-
+
// just to make sure all the bases are covered...
cal.set( Calendar.HOUR_OF_DAY, 23 );
-
+
Date secondTestDate = cal.getTime();
-
+
SimpleDateFormat format =
new SimpleDateFormat( MavenBuildTimestamp.DEFAULT_BUILD_TIMESTAMP_FORMAT );
- assertEquals( "19761111-0016", format.format( firstTestDate ) );
- assertEquals( "19761111-2316", format.format( secondTestDate ) );
+ format.setTimeZone(TimeZone.getTimeZone("UTC"));
+ assertEquals( "1976-11-11T00:16:00Z", format.format( firstTestDate ) );
+ assertEquals( "1976-11-11T23:16:00Z", format.format( secondTestDate ) );
+ }
+
+ public void testDefaultBuildTimestampFormatWithLocalTimeZoneMidnightRollover()
+ {
+ Calendar cal = Calendar.getInstance();
+ cal.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
+
+ cal.set( Calendar.HOUR_OF_DAY, 1 );
+ cal.set( Calendar.MINUTE, 16 );
+ cal.set( Calendar.SECOND, 0 );
+ cal.set( Calendar.YEAR, 2014 );
+ cal.set( Calendar.MONTH, Calendar.JUNE );
+ cal.set( Calendar.DATE, 16 );
+
+ Date firstTestDate = cal.getTime();
+
+ cal.set( Calendar.MONTH, Calendar.NOVEMBER );
+
+ Date secondTestDate = cal.getTime();
+
+ SimpleDateFormat format =
+ new SimpleDateFormat( MavenBuildTimestamp.DEFAULT_BUILD_TIMESTAMP_FORMAT );
+ format.setTimeZone(TimeZone.getTimeZone("UTC"));
+ assertEquals( "2014-06-15T23:16:00Z", format.format( firstTestDate ) );
+ assertEquals( "2014-11-16T00:16:00Z", format.format( secondTestDate ) );
}
public void testShouldNotThrowExceptionOnReferenceToNonExistentValue()
@@ -194,7 +223,7 @@ public abstract class AbstractModelInterpolatorTest
model.setOrganization( org );
ModelInterpolator interpolator = createInterpolator();
-
+
Model out =
interpolator.interpolateModel( model, new File( "." ), createModelBuildingRequest( context ),
new SimpleProblemCollector() );
@@ -219,7 +248,7 @@ public abstract class AbstractModelInterpolatorTest
Model out =
interpolator.interpolateModel( model, new File( "." ), createModelBuildingRequest( context ), collector );
assertColllectorState(0, 0, 1, collector );
-
+
assertEquals( "3.8.1", ( out.getDependencies().get( 0 ) ).getVersion() );
}
@@ -254,8 +283,8 @@ public abstract class AbstractModelInterpolatorTest
final SimpleProblemCollector collector = new SimpleProblemCollector();
Model out =
interpolator.interpolateModel( model, new File( "." ), createModelBuildingRequest( context ), collector );
- assertProblemFree( collector );
-
+ assertProblemFree( collector );
+
assertEquals( "${something}", ( out.getDependencies().get( 0 ) ).getVersion() );
}
@@ -277,7 +306,7 @@ public abstract class AbstractModelInterpolatorTest
Model out =
interpolator.interpolateModel( model, new File( "." ), createModelBuildingRequest( context ), collector );
assertColllectorState( 0, 0, 2, collector );
-
+
assertEquals( "foo-3.8.1", ( out.getDependencies().get( 0 ) ).getVersion() );
}
@@ -298,7 +327,7 @@ public abstract class AbstractModelInterpolatorTest
final SimpleProblemCollector collector = new SimpleProblemCollector();
Model out = interpolator.interpolateModel( model, null, createModelBuildingRequest( context ), collector );
- assertProblemFree( collector );
+ assertProblemFree( collector );
assertEquals( "file://localhost/myBasedir/temp-repo", ( out.getRepositories().get( 0 ) ).getUrl() );
}
@@ -345,7 +374,7 @@ public abstract class AbstractModelInterpolatorTest
final SimpleProblemCollector collector = new SimpleProblemCollector();
Model out =
interpolator.interpolateModel( model, new File( "." ), createModelBuildingRequest( context ), collector );
- assertProblemFree( collector );
+ assertProblemFree( collector );
assertEquals( "/path/to/home", out.getProperties().getProperty( "outputDirectory" ) );
}
@@ -366,7 +395,7 @@ public abstract class AbstractModelInterpolatorTest
final SimpleProblemCollector collector = new SimpleProblemCollector();
Model out =
interpolator.interpolateModel( model, new File( "." ), createModelBuildingRequest( context ), collector );
- assertProblemFree( collector );
+ assertProblemFree( collector );
assertEquals( out.getProperties().getProperty( "outputDirectory" ), "${env.DOES_NOT_EXIST}" );
}
@@ -387,8 +416,8 @@ public abstract class AbstractModelInterpolatorTest
final SimpleProblemCollector collector = new SimpleProblemCollector();
Model out =
interpolator.interpolateModel( model, new File( "." ), createModelBuildingRequest( context ), collector );
- assertProblemFree( collector );
-
+ assertProblemFree( collector );
+
assertEquals( out.getProperties().getProperty( "outputDirectory" ), "${DOES_NOT_EXIST}" );
}
@@ -422,8 +451,8 @@ public abstract class AbstractModelInterpolatorTest
final SimpleProblemCollector collector = new SimpleProblemCollector();
Model out = interpolator.interpolateModel( model, null, createModelBuildingRequest( context ), collector );
assertColllectorState( 0, 0, 2, collector );
-
-
+
+
List<Resource> outResources = out.getBuild().getResources();
Iterator<Resource> resIt = outResources.iterator();
@@ -447,7 +476,7 @@ public abstract class AbstractModelInterpolatorTest
final SimpleProblemCollector collector = new SimpleProblemCollector();
Model result = interpolator.interpolateModel( model, basedir, createModelBuildingRequest( context ), collector );
assertProblemFree( collector );
-
+
List<Dependency> rDeps = result.getDependencies();
assertNotNull( rDeps );
http://git-wip-us.apache.org/repos/asf/maven/blob/cdb8ad6d/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java
index 83038b8..8af32fc 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java
@@ -30,9 +30,9 @@ public class MavenBuildTimestampTest
public void testMavenBuildTimestampUsesUTC()
{
Properties interpolationProperties = new Properties();
- interpolationProperties.setProperty( "maven.build.timestamp.format", "yyyyMMdd-HHmm:z" );
+ interpolationProperties.setProperty( "maven.build.timestamp.format", "yyyyMMdd'T'HHmm'Z'" );
MavenBuildTimestamp timestamp = new MavenBuildTimestamp( new Date(), interpolationProperties );
String formattedTimestamp = timestamp.formattedTimestamp();
- assertTrue( "We expect the UTC marker at the end of the timestamp.", formattedTimestamp.endsWith( "UTC" ) );
+ assertTrue( "We expect the UTC marker at the end of the timestamp.", formattedTimestamp.endsWith( "Z" ) );
}
}
[2/2] git commit: Modified index.apt to reflect output changes from
MNG-5176.
Posted by mi...@apache.org.
Modified index.apt to reflect output changes from MNG-5176.
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/e9e8a209
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/e9e8a209
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/e9e8a209
Branch: refs/heads/master
Commit: e9e8a20907ed35717d5a345d3149a162a8f48a40
Parents: cdb8ad6
Author: Michael Osipov <mi...@apache.org>
Authored: Sun Jun 15 21:03:46 2014 +0200
Committer: Michael Osipov <mi...@apache.org>
Committed: Sun Jun 15 21:03:46 2014 +0200
----------------------------------------------------------------------
maven-model-builder/src/site/apt/index.apt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/e9e8a209/maven-model-builder/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/site/apt/index.apt b/maven-model-builder/src/site/apt/index.apt
index 78e1b32..43265dd 100644
--- a/maven-model-builder/src/site/apt/index.apt
+++ b/maven-model-builder/src/site/apt/index.apt
@@ -136,7 +136,7 @@ Maven Model Builder
*----+------+------+
| <<<maven.version>>> | The version number of the current Maven execution <(since 3.0.4)>. For example, "<<<3.0.5>>>". | <<<$\{maven.version\}>>> |
*----+------+------+
-| <<<maven.build.version>>> | The full build version of the current Maven execution <(since 3.0.4)>. For example, "<<<Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)>>>". | <<<$\{maven.build.version\}>>> |
+| <<<maven.build.version>>> | The full build version of the current Maven execution <(since 3.0.4)>. For example, "<<<Apache Maven 3.2.2 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19T14:51:28+01:00)>>>". | <<<$\{maven.build.version\}>>> |
*----+------+------+
| <<<*>>> | Java system properties (see {{{http://download.oracle.com/javase/6/docs/api/java/lang/System.html#getProperties()}JDK reference}}) | <<<$\{user.home\}>>>\
| | <<<$\{java.home\}>>> |
@@ -154,7 +154,7 @@ Maven Model Builder
{{{../maven-settings/settings.html}Settings Model}},
* encoding configuration have been defined as POM properties looking like POM content but not added to POM model to maintain
- compatibility with previous Maven versions:
+ compatibility with previous Maven versions:
* <<<$\{project.build.sourceEncoding\}>>> for
{{{http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding}source files encoding}}