geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r432531 - /geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
Date Fri, 18 Aug 2006 09:03:08 GMT
Author: gnodet
Date: Fri Aug 18 02:03:06 2006
New Revision: 432531

URL: http://svn.apache.org/viewvc?rev=432531&view=rev
Log:
XBEAN-31: m2 plugin should upload XSD and xsd.html when deploying

Modified:
    geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java

Modified: geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java?rev=432531&r1=432530&r2=432531&view=diff
==============================================================================
--- geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
(original)
+++ geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
Fri Aug 18 02:03:06 2006
@@ -32,6 +32,7 @@
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
 import org.apache.tools.ant.BuildException;
 import org.apache.xbean.spring.generator.DocumentationGenerator;
 import org.apache.xbean.spring.generator.GeneratorPlugin;
@@ -57,19 +58,26 @@
      * @required
      */
     private MavenProject project;
-    
-	/**
+
+    /**
+     * Maven ProjectHelper
+     *
+     * @component
+     */
+    protected MavenProjectHelper projectHelper;
+
+    /**
      * @parameter
      * @required
-	 */
+     */
     private String namespace;
-    
+
     /**
      * @parameter expression="${basedir}/src/main/java"
      * @required
      */
     private File srcDir;
-    
+
     /**
      * @parameter
      */
@@ -80,17 +88,22 @@
      * @required
      */
     private File outputDir;
-    
+
     /**
      * @parameter
      */
     private File schema;
-    
+
     /**
      * @parameter expression="org.apache.xbean.spring.context.impl"
      */
     private String propertyEditorPaths;
-
+
+    /**
+     * @parameter schemaAsArtifact
+     */
+    private boolean schemaAsArtifact = true;
+
     /**
      * A list of additional GeneratorPlugins that should get used executed
      * when generating output.
@@ -98,8 +111,8 @@
      * @parameter
      */
     private List generatorPlugins = Collections.EMPTY_LIST;
-    
-	public void execute() throws MojoExecutionException, MojoFailureException {
+
+    public void execute() throws MojoExecutionException, MojoFailureException {
         getLog().debug( " ======= XBeanMojo settings =======" );
         getLog().debug( "namespace[" + namespace + "]" );
         getLog().debug( "srcDir[" + srcDir + "]" );
@@ -107,6 +120,7 @@
         getLog().debug( "excludedClasses" + excludedClasses );
         getLog().debug( "outputDir[" + outputDir + "]" );
         getLog().debug( "propertyEditorPaths[" + propertyEditorPaths + "]" );
+        getLog().debug( "schemaAsArtifact[" + schemaAsArtifact + "]");
 
         if (schema == null) {
             schema = new File(outputDir, project.getArtifactId() + ".xsd");
@@ -151,10 +165,16 @@
                     plugin.generate(namespaceMapping);
                 }                
                 for (Iterator iter = generatorPlugins.iterator(); iter.hasNext();) {
-					GeneratorPlugin plugin = (GeneratorPlugin) iter.next();
+                    GeneratorPlugin plugin = (GeneratorPlugin) iter.next();
                     plugin.setLog(this);
                     plugin.generate(namespaceMapping);
-				}
+                }
+            }
+
+            // Attach them as artifacts
+            if (schemaAsArtifact) {
+                projectHelper.attachArtifact(project, "xsd", null, schema);
+                projectHelper.attachArtifact(project, "html", "schema", new File(schema.getAbsolutePath()
+ ".html"));
             }
 
             Resource res = new Resource();
@@ -169,11 +189,11 @@
         }
     }
 
-	public void log(String message) {
-		getLog().info(message);
-	}
-
-	public void log(String message, int level) {
-		getLog().info(message);
-	}
+    public void log(String message) {
+        getLog().info(message);
+    }
+
+    public void log(String message, int level) {
+        getLog().info(message);
+    }
 }



Mime
View raw message