maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r561813 - in /maven/sandbox/trunk/plugins/maven-property-setting-plugin: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/maven/ src/main/java/org/apache/maven/plugins/ src/site/ src/sit...
Date Wed, 01 Aug 2007 14:38:18 GMT
Author: brett
Date: Wed Aug  1 07:38:17 2007
New Revision: 561813

URL: http://svn.apache.org/viewvc?view=rev&rev=561813
Log:
very quick stab at a property setting plugin to make sure the interpolation order actually
worked.

Could be made useful for making the timestamp format configuration and adding other properties.

Added:
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/pom.xml   (with props)
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/main/
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/main/java/
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/main/java/org/
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/main/java/org/apache/
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/main/java/org/apache/maven/
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/main/java/org/apache/maven/plugins/
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/main/java/org/apache/maven/plugins/MyMojo.java
  (with props)
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/site/
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/site/apt/
    maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/site/apt/usage.apt

Added: maven/sandbox/trunk/plugins/maven-property-setting-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-property-setting-plugin/pom.xml?view=auto&rev=561813
==============================================================================
--- maven/sandbox/trunk/plugins/maven-property-setting-plugin/pom.xml (added)
+++ maven/sandbox/trunk/plugins/maven-property-setting-plugin/pom.xml Wed Aug  1 07:38:17
2007
@@ -0,0 +1,23 @@
+<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>
+  <groupId>org.apache.maven.plugins</groupId>
+  <artifactId>maven-property-setting-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>maven-property-setting-plugin Maven Mojo</name>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/sandbox/trunk/plugins/maven-property-setting-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/main/java/org/apache/maven/plugins/MyMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/main/java/org/apache/maven/plugins/MyMojo.java?view=auto&rev=561813
==============================================================================
--- maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/main/java/org/apache/maven/plugins/MyMojo.java
(added)
+++ maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/main/java/org/apache/maven/plugins/MyMojo.java
Wed Aug  1 07:38:17 2007
@@ -0,0 +1,48 @@
+package org.apache.maven.plugins;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Date;
+import java.util.Properties;
+
+/**
+ * Goal which touches a timestamp file.
+ *
+ * @goal tstamp
+ * 
+ * @phase validate
+ */
+public class MyMojo
+    extends AbstractMojo
+{
+    /**
+     * @parameter expression="${project.properties}"
+     */
+    private Properties properties;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        properties.setProperty( "tstamp", new Date().toString() );
+    }
+}

Propchange: maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/main/java/org/apache/maven/plugins/MyMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/site/apt/usage.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/site/apt/usage.apt?view=auto&rev=561813
==============================================================================
--- maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/site/apt/usage.apt (added)
+++ maven/sandbox/trunk/plugins/maven-property-setting-plugin/src/site/apt/usage.apt Wed Aug
 1 07:38:17 2007
@@ -0,0 +1,45 @@
+ ----
+ Using the Property Setting Plugin
+ ----
+ Brett Porter
+ ----
+ 2 Aug 2007
+ ----
+
+  Here is an example POM that sets a timestamp and uses it to include in the JAR manifest:
+
+----
+<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>
+  <groupId>test</groupId>
+  <artifactId>test-property</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>test-property</name>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-property-setting-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>tstamp</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifestEntries>
+              <tstamp>${tstamp}</tstamp>
+            </manifestEntries>
+          </archive>    
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
+----
+



Mime
View raw message