You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/06/07 22:22:08 UTC

svn commit: r782452 - in /maven/plugins/trunk/maven-ejb-plugin/src: it/default/ it/reactor/ it/reactor/sub/ it/reactor/sub/src/ it/reactor/sub/src/main/ it/reactor/sub/src/main/java/ it/reactor/sub/src/main/java/org/ it/reactor/sub/src/main/java/org/ap...

Author: bentmann
Date: Sun Jun  7 20:22:07 2009
New Revision: 782452

URL: http://svn.apache.org/viewvc?rev=782452&view=rev
Log:
[MEJB-39] Plugin fails to properly resolve relative path for output directory

Added:
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/pom.xml   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/pom.xml   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/maven/   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/maven/Person.java   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/META-INF/   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/META-INF/ejb-jar.xml   (with props)
    maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/verify.bsh   (with props)
Modified:
    maven/plugins/trunk/maven-ejb-plugin/src/it/default/pom.xml
    maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java
    maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java

Modified: maven/plugins/trunk/maven-ejb-plugin/src/it/default/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/it/default/pom.xml?rev=782452&r1=782451&r2=782452&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/it/default/pom.xml (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/it/default/pom.xml Sun Jun  7 20:22:07 2009
@@ -22,7 +22,7 @@
 <project>
   <modelVersion>4.0.0</modelVersion>
 
-  <groupId>org.apache.maven.its.it0017</groupId>
+  <groupId>org.apache.maven.its.ejb.default</groupId>
   <artifactId>maven-it-it0017</artifactId>
   <version>1.0</version>
   <packaging>ejb</packaging>

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Jun  7 20:22:07 2009
@@ -0,0 +1 @@
+MEJB-\d+

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Added: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/pom.xml?rev=782452&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/pom.xml (added)
+++ maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/pom.xml Sun Jun  7 20:22:07 2009
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.ejb.reactor</groupId>
+  <artifactId>aggregator</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <name>Maven Integration Test</name> 
+  <description>
+    Test that the plugin resolves relative paths properly.
+  </description>
+
+  <modules>
+    <module>sub</module>
+  </modules>
+</project>

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Jun  7 20:22:07 2009
@@ -0,0 +1 @@
+MEJB-\d+

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Added: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/pom.xml?rev=782452&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/pom.xml (added)
+++ maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/pom.xml Sun Jun  7 20:22:07 2009
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.ejb.reactor</groupId>
+  <artifactId>sub</artifactId>
+  <version>1.0</version>
+  <packaging>ejb</packaging>
+
+  <name>Maven Integration Test</name> 
+  <description>
+    Test that the plugin resolves relative paths properly.
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-ejb-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <!-- Note the relative path here -->
+          <outputDirectory>target/classes</outputDirectory>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Jun  7 20:22:07 2009
@@ -0,0 +1 @@
+MEJB-\d+

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Jun  7 20:22:07 2009
@@ -0,0 +1 @@
+MEJB-\d+

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Jun  7 20:22:07 2009
@@ -0,0 +1 @@
+MEJB-\d+

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Jun  7 20:22:07 2009
@@ -0,0 +1 @@
+MEJB-\d+

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Jun  7 20:22:07 2009
@@ -0,0 +1 @@
+MEJB-\d+

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/maven/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Jun  7 20:22:07 2009
@@ -0,0 +1 @@
+MEJB-\d+

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/maven/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Added: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/maven/Person.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/maven/Person.java?rev=782452&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/maven/Person.java (added)
+++ maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/maven/Person.java Sun Jun  7 20:22:07 2009
@@ -0,0 +1,16 @@
+package org.apache.maven;
+
+public class Person
+{
+    private String name;
+    
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+    
+    public String getName()
+    {
+        return name;
+    }
+}

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/maven/Person.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/java/org/apache/maven/Person.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Jun  7 20:22:07 2009
@@ -0,0 +1 @@
+MEJB-\d+

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/META-INF/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sun Jun  7 20:22:07 2009
@@ -0,0 +1 @@
+MEJB-\d+

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/META-INF/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Added: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/META-INF/ejb-jar.xml?rev=782452&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/META-INF/ejb-jar.xml (added)
+++ maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/META-INF/ejb-jar.xml Sun Jun  7 20:22:07 2009
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar>
+  <enterprise-beans>
+    <session>
+      <ejb-name>Hello</ejb-name>
+      <home>org.apache.maven.it0017.HelloHome</home>
+      <remote>org.apache.maven.it0017.Hello</remote>
+      <ejb-class>org.apache.maven.it0017.HelloBean</ejb-class>
+      <session-type>Stateless</session-type>
+      <transaction-type>Container</transaction-type>
+    </session>
+  </enterprise-beans>
+  <assembly-descriptor>
+    <container-transaction>
+      <method>
+        <ejb-name>Hello</ejb-name>
+        <method-name>*</method-name>
+      </method>
+      <trans-attribute>Required</trans-attribute>
+    </container-transaction>
+  </assembly-descriptor>
+</ejb-jar>
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/META-INF/ejb-jar.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/sub/src/main/resources/META-INF/ejb-jar.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/verify.bsh?rev=782452&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/verify.bsh (added)
+++ maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/verify.bsh Sun Jun  7 20:22:07 2009
@@ -0,0 +1,30 @@
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import java.util.regex.*;
+
+File jarFile = new File( basedir, "sub/target/sub-1.0.jar" );
+System.out.println( "Checking for existence of " + jarFile );
+if ( !jarFile.isFile() )
+{
+    throw new Exception( "Missing " + jarFile );
+}
+
+JarFile jar = new JarFile( jarFile );
+
+String[] includedEntries = {
+    "META-INF/ejb-jar.xml",
+    "org/apache/maven/Person.class",
+};
+for ( String included : includedEntries )
+{
+    System.out.println( "Checking for existence of " + included );
+    if ( jar.getEntry( included ) == null )
+    {
+        throw new Exception( "Missing " + included );
+    }
+}
+
+jar.close();
+
+return true;

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ejb-plugin/src/it/reactor/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java?rev=782452&r1=782451&r2=782452&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/ejb/EjbMojo.java Sun Jun  7 20:22:07 2009
@@ -60,12 +60,11 @@
     /**
      * The directory for the generated EJB.
      *
-     * @parameter expression="${project.build.directory}"
+     * @parameter default-value="${project.build.directory}"
      * @required
      * @readonly
-     * @todo use File instead
      */
-    private String basedir;
+    private File basedir;
 
     /**
      * Directory that resources are copied to during the build.
@@ -73,7 +72,7 @@
      * @parameter default-value="${project.build.outputDirectory}" expression="${outputDirectory}"
      * @required
      */
-    private String outputDirectory;
+    private File outputDirectory;
 
     /**
      * The name of the EJB file to generate.
@@ -242,7 +241,7 @@
                 mainJarExcludes = (String[]) excludes.toArray( EMPTY_STRING_ARRAY );
             }
 
-            archiver.getArchiver().addDirectory( new File( outputDirectory ), DEFAULT_INCLUDES, mainJarExcludes );
+            archiver.getArchiver().addDirectory( outputDirectory, DEFAULT_INCLUDES, mainJarExcludes );
 
             if ( deploymentDescriptor.exists() )
             {
@@ -312,7 +311,7 @@
 
             try
             {
-                clientArchiver.getArchiver().addDirectory( new File( outputDirectory ), includes, excludes );
+                clientArchiver.getArchiver().addDirectory( outputDirectory, includes, excludes );
 
                 // create archive
                 clientArchiver.createArchive( project, archive );
@@ -359,7 +358,7 @@
      * @param classifier an optional classifier
      * @return the EJB file to generate
      */
-    private static File getEJBJarFile( String basedir, String finalName, String classifier )
+    private static File getEJBJarFile( File basedir, String finalName, String classifier )
     {
         if ( classifier == null )
         {

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java?rev=782452&r1=782451&r2=782452&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/EjbMojoTest.java Sun Jun  7 20:22:07 2009
@@ -552,8 +552,8 @@
     {
         final EjbMojo mojo = lookupMojo();
         setVariableValueToObject( mojo, "project", project );
-        setVariableValueToObject( mojo, "basedir", project.getBuild().getDirectory() );
-        setVariableValueToObject( mojo, "outputDirectory", project.getBuild().getOutputDirectory() );
+        setVariableValueToObject( mojo, "basedir", new File( project.getBuild().getDirectory() ) );
+        setVariableValueToObject( mojo, "outputDirectory", new File( project.getBuild().getOutputDirectory() ) );
         setVariableValueToObject( mojo, "jarName", DEFAULT_JAR_NAME );
         setVariableValueToObject( mojo, "clientExcludes", clientExcludes );
         setVariableValueToObject( mojo, "clientIncludes", clientIncludes );

Modified: maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java?rev=782452&r1=782451&r2=782452&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java (original)
+++ maven/plugins/trunk/maven-ejb-plugin/src/test/java/org/apache/maven/plugin/ejb/stub/MavenProjectBuildStub.java Sun Jun  7 20:22:07 2009
@@ -326,7 +326,7 @@
     private void populateFile( File file, int type )
     {
         FileOutputStream outputStream;
-        String data = data = (String) dataMap.get( file.getName() );
+        String data = (String) dataMap.get( file.getName() );
 
         if ( ( data != null ) && file.exists() )
         {