Revision: 5667
http://squirrel-sql.svn.sourceforge.net/squirrel-sql/?rev=5667&view=rev
Author: manningr
Date: 2010-07-07 22:12:50 +0000 (Wed, 07 Jul 2010)
Log Message:
-----------
Changes to support new maven version plugin.
Modified Paths:
--------------
trunk/mavenize/app-pom.xml
trunk/mavenize/fw-pom.xml
trunk/mavenize/mavenize.pl
trunk/mavenize/plugin-pom.xml
trunk/mavenize/root-pom.xml
trunk/mavenize/squirrelsql-test-utils/pom.xml
Added Paths:
-----------
trunk/mavenize/squirrelsql-version-plugin/
trunk/mavenize/squirrelsql-version-plugin/pom.xml
trunk/mavenize/update-site/squirrelsql-update-site-plugin/src/main/java/net/sf/squirrel_sql/SquirrelSqlVersionMojo.java
Removed Paths:
-------------
trunk/mavenize/update-site/squirrelsql-update-site-plugin/src/main/java/net/sf/squirrel_sql/BuildUpdateSiteMojo.java
Modified: trunk/mavenize/app-pom.xml
===================================================================
--- trunk/mavenize/app-pom.xml 2010-07-05 18:35:26 UTC (rev 5666)
+++ trunk/mavenize/app-pom.xml 2010-07-07 22:12:50 UTC (rev 5667)
@@ -105,6 +105,8 @@
<version>${surefire-plugin-version}</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <parallel>${surefire-parallel-type}</parallel>
+ <threadCount>${surefire-thread-count}</threadCount>
</configuration>
</plugin>
<plugin>
Modified: trunk/mavenize/fw-pom.xml
===================================================================
--- trunk/mavenize/fw-pom.xml 2010-07-05 18:35:26 UTC (rev 5666)
+++ trunk/mavenize/fw-pom.xml 2010-07-07 22:12:50 UTC (rev 5667)
@@ -224,6 +224,8 @@
<excludes>
<exclude>**/*ExternalTest.java</exclude>
</excludes>
+ <parallel>${surefire-parallel-type}</parallel>
+ <threadCount>${surefire-thread-count}</threadCount>
</configuration>
</plugin>
<plugin>
Modified: trunk/mavenize/mavenize.pl
===================================================================
--- trunk/mavenize/mavenize.pl 2010-07-05 18:35:26 UTC (rev 5666)
+++ trunk/mavenize/mavenize.pl 2010-07-07 22:12:50 UTC (rev 5667)
@@ -787,6 +787,21 @@
chdirOrDie($mavenizeDir);
}
+sub copyVersionPluginProject {
+ chdir($mavenizeDir) or die "Couldn't change directory to $mavenizeDir: $!\n";
+
+ print "Copying in version plugin project\n";
+
+ `svn mkdir --parents $topDir/squirrelsql-version-plugin`;
+ `svn mkdir --parents $topDir/squirrelsql-version-plugin/src/main/java/net/sf/squirrel_sql`;
+
+ `cp $mavenizeDir/squirrelsql-version-plugin/pom.xml $topDir/squirrelsql-version-plugin`;
+ `cp $mavenizeDir/squirrelsql-version-plugin/src/main/java/net/sf/squirrel_sql/SquirrelSqlVersionMojo.java $topDir/squirrelsql-version-plugin/src/main/java/net/sf/squirrel_sql`;
+
+ `svn add $topDir/squirrelsql-version-plugin/pom.xml`;
+ `svn add $topDir/squirrelsql-version-plugin/src/main/java/net/sf/squirrel_sql/SquirrelSqlVersionMojo.java`;
+}
+
sub restructureDocModule {
print "Restructuring doc module\n";
Modified: trunk/mavenize/plugin-pom.xml
===================================================================
--- trunk/mavenize/plugin-pom.xml 2010-07-05 18:35:26 UTC (rev 5666)
+++ trunk/mavenize/plugin-pom.xml 2010-07-07 22:12:50 UTC (rev 5667)
@@ -1,152 +1,135 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>net.sf.squirrel-sql.plugins</groupId>
- <artifactId>squirrelsql-plugins-parent-pom</artifactId>
- <version>3.2.0-SNAPSHOT</version>
- </parent>
-
- <groupId>net.sf.squirrel-sql.plugins</groupId>
- <artifactId>@@--$artifactId--@@</artifactId>
- <version>3.2.0-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <name>@@--$pluginName--@@</name>
- <description>@@--$pluginDescription--@@</description>
- <inceptionYear>2001</inceptionYear>
- <developers>
- <developer>
- <name>Gerd Wagner</name>
- <roles>
- <role>Administrator</role>
- <role>Developer</role>
- </roles>
- </developer>
- <developer>
- <name>Rob Manning</name>
- <roles>
- <role>Developer</role>
- <role>Release Manager</role>
- </roles>
- </developer>
- </developers>
- <licenses>
- <license>
- <name>GNU Lesser General Public License</name>
- <url>http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <url>http://www.squirrelsql.org/</url>
- <scm>
- <connection>scm:svn:https://squirrel-sql.svn.sourceforge.net/svnroot/squirrel-sql/trunk/sql12/</connection>
- <developerConnection>scm:svn:http://squirrel-sql.svn.sourceforge.net/viewvc/squirrel-sql/trunk/sql12/</developerConnection>
- <url>http://squirrel-sql.svn.sourceforge.net/viewvc/squirrel-sql/trunk/sql12/</url>
- </scm>
- <issueManagement>
- <system>SourceForge Tracker</system>
- <url>http://sourceforge.net/tracker/?group_id=28383%26atid=393414</url>
- </issueManagement>
- <ciManagement>
- <system>Hudson</system>
- <url>https://www.squirrel-sql.org/hudson/</url>
- </ciManagement>
-
- <dependencies>
- <dependency>
+<project
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>net.sf.squirrel-sql.plugins</groupId>
+ <artifactId>squirrelsql-plugins-parent-pom</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </parent>
+ <groupId>net.sf.squirrel-sql.plugins</groupId>
+ <artifactId>@@--$artifactId--@@</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>@@--$pluginName--@@</name>
+ <description>@@--$pluginDescription--@@</description>
+ <inceptionYear>2001</inceptionYear>
+ <developers>
+ <developer>
+ <name>Gerd Wagner</name>
+ <roles>
+ <role>Administrator</role>
+ <role>Developer</role>
+ </roles>
+ </developer>
+ <developer>
+ <name>Rob Manning</name>
+ <roles>
+ <role>Developer</role>
+ <role>Release Manager</role>
+ </roles>
+ </developer>
+ </developers>
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License</name>
+ <url>http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <url>http://www.squirrelsql.org/</url>
+ <scm>
+ <connection>scm:svn:https://squirrel-sql.svn.sourceforge.net/svnroot/squirrel-sql/trunk/sql12/</connection>
+ <developerConnection>scm:svn:http://squirrel-sql.svn.sourceforge.net/viewvc/squirrel-sql/trunk/sql12/</developerConnection>
+ <url>http://squirrel-sql.svn.sourceforge.net/viewvc/squirrel-sql/trunk/sql12/</url>
+ </scm>
+ <issueManagement>
+ <system>SourceForge Tracker</system>
+ <url>http://sourceforge.net/tracker/?group_id=28383%26atid=393414</url>
+ </issueManagement>
+ <ciManagement>
+ <system>Hudson</system>
+ <url>https://www.squirrel-sql.org/hudson/</url>
+ </ciManagement>
+ <dependencies>
+ <dependency>
<groupId>net.sf.squirrel-sql</groupId>
<artifactId>fw</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sf.squirrel-sql</groupId>
<artifactId>squirrel-sql</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sf.squirrel-sql</groupId>
<artifactId>squirrel-sql</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>gsbase</groupId>
- <artifactId>gsbase</artifactId>
+ <groupId>net.sf.squirrel-sql</groupId>
+ <artifactId>squirrelsql-test-utils</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <type>pom</type>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
- <scope>test</scope>
- </dependency>
-
@@--$dependencies--@@
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <version>${source-plugin-version}</version>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>${surefire-plugin-version}</version>
- </plugin>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <version>${jar-plugin-version}</version>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>${assembly-plugin-version}</version>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <version>${findbugs-plugin-version}</version>
- </plugin>
- <plugin>
- <artifactId>maven-pmd-plugin</artifactId>
- <version>${pmd-plugin-version}</version>
- </plugin>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle-plugin-version}</version>
- </plugin>
- </plugins>
- </build>
- <profiles>
- <!--
- Since generating javadoc can be time-consuming, this is not done unless a "javadoc" profile
- is activated.
- -->
- <profile>
- <id>javadoc</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>${javadoc-plugin-version}</version>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-
-</project>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>${source-plugin-version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire-plugin-version}</version>
+ <configuration>
+ <parallel>${surefire-parallel-type}</parallel>
+ <threadCount>${surefire-thread-count}</threadCount>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>${jar-plugin-version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>${assembly-plugin-version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <version>${findbugs-plugin-version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>${pmd-plugin-version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>${checkstyle-plugin-version}</version>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <!--
+ Since generating javadoc can be time-consuming, this is not done unless a "javadoc" profile is activated.
+ -->
+ <profile>
+ <id>javadoc</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>${javadoc-plugin-version}</version>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
Modified: trunk/mavenize/root-pom.xml
===================================================================
--- trunk/mavenize/root-pom.xml 2010-07-05 18:35:26 UTC (rev 5666)
+++ trunk/mavenize/root-pom.xml 2010-07-07 22:12:50 UTC (rev 5667)
@@ -53,7 +53,7 @@
</ciManagement>
<properties>
- <!-- Maven plugin version -->
+ <!-- Maven plugin versions -->
<assembly-plugin-version>2.2-beta-2</assembly-plugin-version>
<checkstyle-plugin-version>2.2</checkstyle-plugin-version>
<compiler-plugin-version>2.0.2</compiler-plugin-version>
@@ -67,10 +67,19 @@
<maven-plugin-api-version>2.0</maven-plugin-api-version>
<pmd-plugin-version>2.4</pmd-plugin-version>
<source-plugin-version>2.1</source-plugin-version>
- <surefire-plugin-version>2.4</surefire-plugin-version>
+ <surefire-plugin-version>2.5</surefire-plugin-version>
+
<!-- Thirdparty Library Versions -->
+ <easymock-version>2.4</easymock-version>
+ <easymockclassextension-version>2.4</easymockclassextension-version>
+ <gsbase-version>2.0.1</gsbase-version>
<hibernate-annotations-version>3.3.0.ga</hibernate-annotations-version>
+ <junit-version>4.7</junit-version>
<spring-framework-version>2.5.2</spring-framework-version>
+
+ <!-- Other -->
+ <surefire-parallel-type>classes</surefire-parallel-type>
+ <surefire-thread-count>4</surefire-thread-count>
</properties>
<modules>
@@ -115,6 +124,7 @@
<module>app</module>
<module>plugins</module>
<module>squirrelsql-translations</module>
+ <module>squirrelsql-version-plugin</module>
<module>doc</module>
<module>web-site</module>
<module>installer</module>
Modified: trunk/mavenize/squirrelsql-test-utils/pom.xml
===================================================================
--- trunk/mavenize/squirrelsql-test-utils/pom.xml 2010-07-05 18:35:26 UTC (rev 5666)
+++ trunk/mavenize/squirrelsql-test-utils/pom.xml 2010-07-07 22:12:50 UTC (rev 5667)
@@ -64,22 +64,22 @@
<dependency>
<groupId>gsbase</groupId>
<artifactId>gsbase</artifactId>
- <version>2.0.1</version>
+ <version>${gsbase-version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.6</version>
+ <version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
- <version>2.4</version>
+ <version>${easymock-version}</version>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
- <version>2.4</version>
+ <version>${easymockclassextension-version}</version>
</dependency>
</dependencies>
Added: trunk/mavenize/squirrelsql-version-plugin/pom.xml
===================================================================
--- trunk/mavenize/squirrelsql-version-plugin/pom.xml (rev 0)
+++ trunk/mavenize/squirrelsql-version-plugin/pom.xml 2010-07-07 22:12:50 UTC (rev 5667)
@@ -0,0 +1,92 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>net.sf.squirrel-sql</groupId>
+ <artifactId>squirrel-root-pom</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>net.sf.squirrel-sql</groupId>
+ <artifactId>squirrelsql-version-plugin</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <name>SQuirreLSQL Version Maven Mojo</name>
+ <description>
+ This project produces a maven mojo that can set the System property "squirrelsql.version" so that
+ it can be used globally by the installers and the update-site projects. It accepts the project
+ version as an argument which it uses to decide what the squirrelsql.version should be. If the
+ project version ends with "-SNAPSHOT", then the squirrelsql.version will be set to
+ Snapshot-{timestamp} where {timestamp} is the current timestamp in the form of YYYYMMDD_HHMM. If
+ however, the project version does not end with "-SNAPSHOT", then squirrelsql.version will be set to
+ the value of the project version.
+ </description>
+
+ <inceptionYear>2001</inceptionYear>
+ <developers>
+ <developer>
+ <name>Gerd Wagner</name>
+ <roles>
+ <role>Administrator</role>
+ <role>Developer</role>
+ </roles>
+ </developer>
+ <developer>
+ <name>Rob Manning</name>
+ <roles>
+ <role>Developer</role>
+ <role>Release Manager</role>
+ </roles>
+ </developer>
+ </developers>
+ <licenses>
+ <license>
+ <name>GNU Lesser</name>
+ <url>http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <url>http://www.squirrelsql.org/</url>
+ <scm>
+ <connection>scm:svn:https://squirrel-sql.svn.sourceforge.net/svnroot/squirrel-sql/trunk/sql12/</connection>
+ <developerConnection>scm:svn:http://squirrel-sql.svn.sourceforge.net/viewvc/squirrel-sql/trunk/sql12/</developerConnection>
+ <url>http://squirrel-sql.svn.sourceforge.net/viewvc/squirrel-sql/trunk/sql12/</url>
+ </scm>
+ <issueManagement>
+ <system>SourceForge Tracker</system>
+ <url>http://sourceforge.net/tracker/?group_id=28383%26atid=393414</url>
+ </issueManagement>
+ <ciManagement>
+ <system>Hudson</system>
+ <url>https://www.squirrel-sql.org/hudson/</url>
+ </ciManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>squirrel-sql</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${maven-plugin-api-version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <!-- http://maven.apache.org/plugins/maven-compiler-plugin/ -->
+ <source>${javac-source-version}</source>
+ <target>${javac-target-version}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: trunk/mavenize/update-site/squirrelsql-update-site-plugin/src/main/java/net/sf/squirrel_sql/BuildUpdateSiteMojo.java
===================================================================
--- trunk/mavenize/update-site/squirrelsql-update-site-plugin/src/main/java/net/sf/squirrel_sql/BuildUpdateSiteMojo.java 2010-07-05 18:35:26 UTC (rev 5666)
+++ trunk/mavenize/update-site/squirrelsql-update-site-plugin/src/main/java/net/sf/squirrel_sql/BuildUpdateSiteMojo.java 2010-07-07 22:12:50 UTC (rev 5667)
@@ -1,224 +0,0 @@
-package net.sf.squirrel_sql;
-
-/*
- * Copyright (C) 2009 Rob Manning
- * man...@us...
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import net.sourceforge.squirrel_sql.client.update.UpdateUtil;
-import net.sourceforge.squirrel_sql.client.update.xmlbeans.ArtifactXmlBean;
-import net.sourceforge.squirrel_sql.client.update.xmlbeans.ChannelXmlBean;
-import net.sourceforge.squirrel_sql.client.update.xmlbeans.ModuleXmlBean;
-import net.sourceforge.squirrel_sql.client.update.xmlbeans.ReleaseXmlBean;
-import net.sourceforge.squirrel_sql.client.update.xmlbeans.UpdateXmlSerializer;
-import net.sourceforge.squirrel_sql.client.update.xmlbeans.UpdateXmlSerializerImpl;
-import net.sourceforge.squirrel_sql.client.update.xmlbeans.XmlBeanUtilities;
-import net.sourceforge.squirrel_sql.fw.util.IOUtilities;
-import net.sourceforge.squirrel_sql.fw.util.IOUtilitiesImpl;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-
-/**
- * Goal which builds the update site from a directory which is specified as an argument.
- *
- * @goal build-update-site
- * @phase package
- */
-public class BuildUpdateSiteMojo extends AbstractMojo
-{
-
- private org.apache.maven.plugin.logging.Log log = getLog();
-
- private IOUtilities _iou = new IOUtilitiesImpl();
-
- /**
- * Transitive dependencies that are not used directly by SQuirreL are excluded so that the update site
- * doesn't become a poor man's maven repository. We only want artifacts that are used directly by SQuirreL
- * or plugin code - no artifacts that are needed solely for build purposes should be included. Also, we
- * exclude look and feel jars, since these need to be in a special directory beneath the LAF plugin
- * directory. Lastly, we also exclude the translation jars artifact, since this is already unpacked by
- * maven into the i18n directory, so they don't need to appear in core. Note: any files found in the
- * release directory that match any pattern in this list will not be included and will also be deleted.
- */
- private static final String[] excludedPatterns =
- new String[] { "maven", "plexus", "ant.jar", "ant-", "aopalliance", "axis", "classworlds",
- "commons-beanutils", "commons-digester", "commons-lang", "commons-validator", "doxia", "ehcache",
- "file-management", "tests", "hibernate-validator", "ilf-gpl", "javassist", "jboss", "jsch",
- "jtidy", "junit", "kunststoff", "looks", "metouia", "napkinlaf", "nimrodlf", "oalnf", "oro.jar",
- "persistence.jar", "skinlf", "squirrelsql-translations", "substance", "swingsetthemes",
- "tinylaf", "toniclf", "velocity", "wagon", "xml-apis" };
-
- /**
- * Location of the directory which contains the release artifacts
- *
- * @parameter expression="${releaseDirectory}"
- * @required
- */
- private String releaseDirectory;
-
- public void setReleaseDirectory(String releaseDirectory)
- {
- this.releaseDirectory = releaseDirectory;
- }
-
- /**
- * The version for the release.
- *
- * @parameter expression="${releaseVersion}"
- * @required
- */
- private String releaseVersion;
-
- public void setReleaseVersion(String releaseVersion)
- {
- this.releaseVersion = releaseVersion;
- }
-
- /**
- * Does the main work provided by this plugin.
- *
- * @throws MojoExecutionException
- * if the releaseDirectory isn't specified, doesn't exist or cannot be read.
- */
- public void execute() throws MojoExecutionException
- {
- String channelName = "snapshot";
- String releaseName = "snapshot";
-
- if (!releaseVersion.toLowerCase().startsWith("snapshot"))
- {
- channelName = "stable";
- releaseName = "stable";
- }
-
- if (releaseDirectory == null) { throw new MojoExecutionException("releaseDirectory cannot be null."); }
- File releaseDir = new File(releaseDirectory);
- if (!releaseDir.exists()) { throw new MojoExecutionException("the specified releaseDirectory ("
- + releaseDirectory + ") doesn't appear to exist."); }
- if (!releaseDir.canRead()) { throw new MojoExecutionException(
- "Cannot read the specified releaseDirectory: " + releaseDirectory); }
-
- File f = new File(releaseDirectory, UpdateUtil.RELEASE_XML_FILENAME);
-
- try
- {
- ChannelXmlBean channelBean =
- buildChannelRelease(channelName, releaseName, releaseVersion, releaseDir.getAbsolutePath());
- UpdateXmlSerializer serializer = new UpdateXmlSerializerImpl();
- if (log.isInfoEnabled())
- {
- log.info("Writing channel release bean to " + f);
- }
- serializer.write(channelBean, f.getAbsolutePath());
- }
- catch (IOException e)
- {
- throw new MojoExecutionException("Failed to create update site", e);
- }
- }
-
- /**
- * This will create a ChannelXmlBean that describes a release as it is found in the specified directory,
- * using the specified releaseName and version. This will excluded files that match any patterns in the
- * excludePatterns array. Files that are excluded are also deleted from the release directory as they will
- * not be shipped with the update site, and are therefore not required.
- *
- * @param channelName
- * the name of the channel.
- * @param releaseName
- * the name of the release.
- * @param version
- * the version of the release.
- * @param directory
- * the directory to use as the top-level of the release.
- * @return a ChannelXmlBean that represents the specified parameters and files found in the release
- * directory that don't match any exclude pattern.
- */
- private ChannelXmlBean buildChannelRelease(String channelName,
- String releaseName, String version, String directory)
- throws IOException {
- ChannelXmlBean result = new ChannelXmlBean();
- result.setName(channelName);
- ReleaseXmlBean releaseBean = new ReleaseXmlBean(releaseName, version);
- releaseBean.setCreateTime(new Date());
- File dir = new File(directory);
- for (File f : dir.listFiles()) {
- if (log.isInfoEnabled()) {
- log.info("Processing module directory: " + f);
- }
- if (f.isDirectory()) {
- // f is a module
- ModuleXmlBean module = new ModuleXmlBean();
- module.setName(f.getName());
- for (File a : f.listFiles()) {
- String filename = a.getName();
- if (isExcluded(filename)) {
- a.delete();
- continue;
- }
- if (log.isDebugEnabled()) {
- log.debug("Processing artifact file: " + filename);
- }
- String type = filename.substring(filename.indexOf(".") + 1);
- ArtifactXmlBean artifact = new ArtifactXmlBean();
- artifact.setName(a.getName());
- artifact.setType(type);
- artifact.setVersion(version);
- artifact.setSize(a.length());
- artifact.setChecksum(_iou.getCheckSum(a));
- module.addArtifact(artifact);
- }
- releaseBean.addmodule(module);
- }
- }
- result.setCurrentRelease(releaseBean);
- return result;
- }
-
- /**
- * Searches for the specified filename in the excludedPatterns array and compares to see if any pattern
- * matches.
- *
- * @param filename
- * the name of the artifact to look for.
- * @return true if the filename matches any exclude pattern; false otherwise.
- */
- private boolean isExcluded(String filename) {
- boolean result = false;
- for (String pattern : excludedPatterns) {
- if (filename.matches(".*" + pattern + ".*")) {
- if (log.isDebugEnabled()) {
- log.debug("Excluding filename (" + filename
- + " because it matched an exclude pattern: "
- + pattern);
- }
- result = true;
- break;
- }
- }
- return result;
- }
-}
Copied: trunk/mavenize/update-site/squirrelsql-update-site-plugin/src/main/java/net/sf/squirrel_sql/SquirrelSqlVersionMojo.java (from rev 5647, trunk/mavenize/update-site/squirrelsql-update-site-plugin/src/main/java/net/sf/squirrel_sql/BuildUpdateSiteMojo.java)
===================================================================
--- trunk/mavenize/update-site/squirrelsql-update-site-plugin/src/main/java/net/sf/squirrel_sql/SquirrelSqlVersionMojo.java (rev 0)
+++ trunk/mavenize/update-site/squirrelsql-update-site-plugin/src/main/java/net/sf/squirrel_sql/SquirrelSqlVersionMojo.java 2010-07-07 22:12:50 UTC (rev 5667)
@@ -0,0 +1,111 @@
+package net.sf.squirrel_sql;
+
+/*
+ * Copyright (C) 2010 Rob Manning
+ * man...@us...
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import net.sourceforge.squirrel_sql.client.update.UpdateUtil;
+import net.sourceforge.squirrel_sql.client.update.xmlbeans.ArtifactXmlBean;
+import net.sourceforge.squirrel_sql.client.update.xmlbeans.ChannelXmlBean;
+import net.sourceforge.squirrel_sql.client.update.xmlbeans.ModuleXmlBean;
+import net.sourceforge.squirrel_sql.client.update.xmlbeans.ReleaseXmlBean;
+import net.sourceforge.squirrel_sql.client.update.xmlbeans.UpdateXmlSerializer;
+import net.sourceforge.squirrel_sql.client.update.xmlbeans.UpdateXmlSerializerImpl;
+import net.sourceforge.squirrel_sql.client.update.xmlbeans.XmlBeanUtilities;
+import net.sourceforge.squirrel_sql.fw.util.IOUtilities;
+import net.sourceforge.squirrel_sql.fw.util.IOUtilitiesImpl;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Goal which sets the System property "squirrelsql.version" based on the value of project version. Sets the
+ * System property "squirrelsql.version" so that it can be used globally by the installers and the
+ * update-site projects. It accepts the project version as an argument which it uses to decide what the
+ * squirrelsql.version should be. If the project version ends with "-SNAPSHOT", then the squirrelsql.version
+ * will be set to Snapshot-{timestamp} where {timestamp} is the current timestamp in the form of
+ * YYYYMMDD_HHMM. If however, the project version does not end with "-SNAPSHOT", then squirrelsql.version
+ * will be set to the value of the project version. This mojo should only be executed once during the
+ * build since it manipulates globally-accessible properties. This is particularly important in the case
+ * of snapshot project versions.
+ *
+ * @goal set-version
+ * @phase initialize
+ */
+public class SquirrelSqlVersionMojo extends AbstractMojo
+{
+
+ private org.apache.maven.plugin.logging.Log log = getLog();
+
+ public static String VERSION_PROPERTY_KEY = "squirrelsql.version";
+
+ /**
+ * The version for the release.
+ *
+ * @parameter expression="${projectVersion}"
+ * @required
+ */
+ private String projectVersion;
+
+ public void setprojectVersion(String projectVersion)
+ {
+ this.projectVersion = projectVersion;
+ }
+
+ /**
+ * Does the main work provided by this plugin.
+ *
+ * @throws MojoExecutionException
+ * if the projectVersion isn't specified.
+ */
+ public void execute() throws MojoExecutionException
+ {
+ if (projectVersion == null) { throw new MojoExecutionException("projectVersion cannot be null."); }
+
+ String squirrelsqlVersion = projectVersion;
+
+ if (!projectVersion.toLowerCase().endsWith("-snapshot"))
+ {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_kkmm");
+ try
+ {
+ String date = sdf.format(new Date());
+ squirrelsqlVersion = "Snapshot-" + date;
+ }
+ catch (IllegalStateException e)
+ {
+ log.error("Could not convert date format pattern " + timestampPattern);
+ throw e;
+ }
+ }
+
+ Properties props = project.getProperties();
+ props.put(VERSION_PROPERTY_KEY, squirrelsqlVersion);
+ System.setProperty(VERSION_PROPERTY_KEY, squirrelsqlVersion)
+
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|