You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2006/08/21 23:11:31 UTC
svn commit: r433361 - in /maven/shared/trunk/maven-archiver: pom.xml
src/main/java/org/apache/maven/archiver/MavenArchiveConfiguration.java
src/main/java/org/apache/maven/archiver/MavenArchiver.java
Author: jvanzyl
Date: Mon Aug 21 14:11:29 2006
New Revision: 433361
URL: http://svn.apache.org/viewvc?rev=433361&view=rev
Log:
[MJAR-7] Prevent the JAR plugin from recreating the archive all the time
Submitted by: Jochen Wiedmann
Modified:
maven/shared/trunk/maven-archiver/pom.xml
maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiveConfiguration.java
maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiver.java
Modified: maven/shared/trunk/maven-archiver/pom.xml
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-archiver/pom.xml?rev=433361&r1=433360&r2=433361&view=diff
==============================================================================
--- maven/shared/trunk/maven-archiver/pom.xml (original)
+++ maven/shared/trunk/maven-archiver/pom.xml Mon Aug 21 14:11:29 2006
@@ -18,7 +18,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
- <version>1.0-alpha-6</version>
+ <version>1.0-alpha-7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Modified: maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiveConfiguration.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiveConfiguration.java?rev=433361&r1=433360&r2=433361&view=diff
==============================================================================
--- maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiveConfiguration.java (original)
+++ maven/shared/trunk/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiveConfiguration.java Mon Aug 21 14:11:29 2006
@@ -44,7 +44,9 @@
private Map manifestEntries = new HashMap();
private List manifestSections = new ArrayList();
-
+
+ private boolean forced = true;
+
public boolean isCompress()
{
return compress;
@@ -133,5 +135,47 @@
public List getManifestSections() {
return manifestSections;
+ }
+
+ /**
+ * <p>Returns, whether recreating the archive is forced (default). Setting
+ * this option to false means, that the archiver should compare the
+ * timestamps of included files with the timestamp of the target archive
+ * and rebuild the archive only, if the latter timestamp precedes the
+ * former timestamps. Checking for timestamps will typically offer a
+ * performance gain (in particular, if the following steps in a build
+ * can be suppressed, if an archive isn't recrated) on the cost that
+ * you get inaccurate results from time to time. In particular, removal
+ * of source files won't be detected.</p>
+ * <p>An archiver doesn't necessarily support checks for uptodate. If
+ * so, setting this option to true will simply be ignored.</p>
+ * @return True, if the target archive should always be created; false
+ * otherwise
+ * @see #setForced(boolean)
+ */
+ public boolean isForced()
+ {
+ return forced;
+ }
+
+ /**
+ * <p>Sets, whether recreating the archive is forced (default). Setting
+ * this option to false means, that the archiver should compare the
+ * timestamps of included files with the timestamp of the target archive
+ * and rebuild the archive only, if the latter timestamp precedes the
+ * former timestamps. Checking for timestamps will typically offer a
+ * performance gain (in particular, if the following steps in a build
+ * can be suppressed, if an archive isn't recrated) on the cost that
+ * you get inaccurate results from time to time. In particular, removal
+ * of source files won't be detected.</p>
+ * <p>An archiver doesn't necessarily support checks for uptodate. If
+ * so, setting this option to true will simply be ignored.</p>
+ * @param forced True, if the target archive should always be created; false
+ * otherwise
+ * @see #isForced()
+ */
+ void setForced( boolean forced )
+ {
+ this.forced = forced;
}
}
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=433361&r1=433360&r2=433361&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 Mon Aug 21 14:11:29 2006
@@ -390,6 +390,14 @@
}
}
+ boolean forced = archiveConfiguration.isForced();
+ archiver.setForced( forced );
+ if ( !archiveConfiguration.isForced() && archiver.isSupportingForced() )
+ {
+ // Should issue a warning here, but how do we get a logger?
+ //getLog().warn( "Forced build is disabled, but disabling the forced mode isn't supported by the archiver." );
+ }
+
// create archive
archiver.createArchive();