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/10/19 06:53:01 UTC

svn commit: r465484 - in /maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter: ./ 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/plugin/ src/main/java...

Author: jvanzyl
Date: Wed Oct 18 21:53:00 2006
New Revision: 465484

URL: http://svn.apache.org/viewvc?view=rev&rev=465484
Log:
o decomposing setter-based plugin from the core IT plugin

Added:
    maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/
    maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/pom.xml   (with props)
    maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/
    maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/
    maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/
    maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/org/
    maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/
    maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/
    maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/
    maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/coreit/
    maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java   (with props)

Added: maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/pom.xml?view=auto&rev=465484
==============================================================================
--- maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/pom.xml (added)
+++ maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/pom.xml Wed Oct 18 21:53:00 2006
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Copyright 2005-2006 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.
+  -->
+
+<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">
+  <parent>
+    <artifactId>maven-plugins</artifactId>
+    <groupId>org.apache.maven.plugins</groupId>
+    <version>2-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>maven-it-plugin-setter</artifactId>
+  <packaging>maven-plugin</packaging>
+  <name>Maven Core Integration Test Plugin</name>
+  <version>1.0-SNAPSHOT</version>
+  <inceptionYear>2001</inceptionYear>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <!--
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0</version>
+    </dependency>
+    -->
+  </dependencies>
+</project>

Propchange: maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java?view=auto&rev=465484
==============================================================================
--- maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java (added)
+++ maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java Wed Oct 18 21:53:00 2006
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * @goal setter-touch
+ *
+ * @description Goal which cleans the build
+ */
+public class CoreItMojoWithSetters
+    extends AbstractMojo
+{
+    /**
+     * @parameter
+     *   property="outputDirectory"
+     *   expression="${project.build.directory}"
+     * @required
+     */
+    private String outputDirectoryValue;
+
+    /**
+     * @parameter property="foo"
+     */
+    private String fooValue;
+
+    /**
+     * @parameter
+     */
+    private String bar;
+
+    // ----------------------------------------------------------------------
+    // Setters
+    // ----------------------------------------------------------------------
+
+    public void setOutputDirectory( String outputDirectory )
+    {
+        this.outputDirectoryValue = outputDirectory;
+    }
+
+    boolean setFooSetterExecuted;
+
+    public void setFoo( String fooValue )
+    {
+        this.fooValue = fooValue;
+
+        setFooSetterExecuted = true;
+    }
+
+    boolean setBarSetterExecuted;
+
+    public void setBar( String barValue )
+    {
+        this.bar = barValue + ".baz";
+
+        setBarSetterExecuted = true;
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        touch( new File( outputDirectoryValue ), "touch.txt" );
+
+        File outDir = new File( outputDirectoryValue );
+
+        // Test parameter setting
+        if ( fooValue != null && setFooSetterExecuted )
+        {
+            touch( outDir, fooValue );
+        }
+
+        if ( bar != null && setBarSetterExecuted )
+        {
+            touch( outDir, bar );
+        }
+    }
+
+    private static void touch( File dir, String file )
+        throws MojoExecutionException
+    {
+        try
+        {
+             if ( !dir.exists() )
+             {
+                 dir.mkdirs();
+             }
+
+             File touch = new File( dir, file );
+
+             FileWriter w = new FileWriter( touch );
+
+             w.write( file );
+
+             w.close();
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Error touching file", e );
+        }
+    }
+}

Propchange: maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-setter/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"