[maven-eclipse-plugin] Fix build in pure maven 3 environment.

Alexander Kurtakov akurtakov at fedoraproject.org
Mon Dec 5 22:02:22 UTC 2011


commit a4a96c474374b95c60027426b086defb8a489302
Author: Alexander Kurtakov < <akurtako at redhat.com>
Date:   Tue Dec 6 00:02:04 2011 +0200

     Fix build in pure maven 3 environment.

 .gitignore                                     |    1 +
 add_compat.patch                               |   14 ++++
 kill-bsh.patch                                 |   90 ++++++++++++------------
 maven-eclipse-plugin-depmap.xml                |   16 ----
 maven-eclipse-plugin-install-plugin-mojo.patch |   13 ----
 maven-eclipse-plugin-pom.patch                 |   73 -------------------
 maven-eclipse-plugin.spec                      |   59 ++++------------
 reduced_exception.patch                        |   46 ++++++++++++
 sources                                        |    2 +-
 9 files changed, 122 insertions(+), 192 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 072aa6e..2071ba3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 maven-eclipse-plugin-2.8.tgz
+maven-eclipse-plugin-2.8-source-release.zip
diff --git a/add_compat.patch b/add_compat.patch
new file mode 100644
index 0000000..9d2e8c6
--- /dev/null
+++ b/add_compat.patch
@@ -0,0 +1,14 @@
+--- pom.xml.sav	2011-12-05 23:27:19.000000000 +0200
++++ pom.xml	2011-12-05 23:29:09.257776418 +0200
+@@ -88,6 +88,11 @@ under the License.
+       <version>2.0.8</version>
+     </dependency>
+     <dependency>
++      <groupId>org.apache.maven</groupId>
++      <artifactId>maven-compat</artifactId>
++      <version>3.0.2</version>
++    </dependency>
++    <dependency>
+       <groupId>org.codehaus.plexus</groupId>
+       <artifactId>plexus-utils</artifactId>
+       <version>1.5.6</version>
diff --git a/kill-bsh.patch b/kill-bsh.patch
index e7db682..bc3c64f 100644
--- a/kill-bsh.patch
+++ b/kill-bsh.patch
@@ -1,45 +1,45 @@
---- pom.xml.sav	2011-06-17 05:34:44.000000000 +0300
-+++ pom.xml	2011-06-17 05:41:02.591296595 +0300
-@@ -220,42 +220,6 @@ under the License.
-         <version>2.4.3</version>
-       </plugin>
-       <plugin>
--        <groupId>org.apache.maven.plugins</groupId>
--        <artifactId>maven-antrun-plugin</artifactId>
--        <executions>
--          <execution>
--            <id>verify-integration-tests-checks</id>
--            <phase>post-integration-test</phase>
--            <configuration>
--              <tasks>
--                <property name="script" location="verify-integration-tests-checks.bsh" />
--                <script language="beanshell" src="${script}" />
--              </tasks>
--            </configuration>
--            <goals>
--              <goal>run</goal>
--            </goals>
--          </execution>
--        </executions>
--        <dependencies>
--          <dependency>
--            <groupId>org.apache.ant</groupId>
--            <artifactId>ant-nodeps</artifactId>
--            <version>1.7.1</version>
--          </dependency>
--          <dependency>
--            <groupId>org.apache.ant</groupId>
--            <artifactId>ant-apache-bsf</artifactId>
--            <version>1.7.1</version>
--          </dependency>
--          <dependency>
--            <groupId>org.beanshell</groupId>
--            <artifactId>bsh</artifactId>
--            <version>2.0b4</version>
--          </dependency>
--        </dependencies>
--      </plugin>
--      <plugin>
-         <artifactId>maven-enforcer-plugin</artifactId>
-         <executions>
-           <execution>
+--- pom.xml.orig	2011-12-05 23:49:11.000000000 +0200
++++ pom.xml	2011-12-05 23:49:58.223545303 +0200
+@@ -225,42 +225,6 @@ under the License.
+         <version>2.4.3</version>
+       </plugin>
+       <plugin>
+-        <groupId>org.apache.maven.plugins</groupId>
+-        <artifactId>maven-antrun-plugin</artifactId>
+-        <executions>
+-          <execution>
+-            <id>verify-integration-tests-checks</id>
+-            <phase>post-integration-test</phase>
+-            <configuration>
+-              <tasks>
+-                <property name="script" location="verify-integration-tests-checks.bsh" />
+-                <script language="beanshell" src="${script}" />
+-              </tasks>
+-            </configuration>
+-            <goals>
+-              <goal>run</goal>
+-            </goals>
+-          </execution>
+-        </executions>
+-        <dependencies>
+-          <dependency>
+-            <groupId>org.apache.ant</groupId>
+-            <artifactId>ant-nodeps</artifactId>
+-            <version>1.7.1</version>
+-          </dependency>
+-          <dependency>
+-            <groupId>org.apache.ant</groupId>
+-            <artifactId>ant-apache-bsf</artifactId>
+-            <version>1.7.1</version>
+-          </dependency>
+-          <dependency>
+-            <groupId>org.beanshell</groupId>
+-            <artifactId>bsh</artifactId>
+-            <version>2.0b4</version>
+-          </dependency>
+-        </dependencies>
+-      </plugin>
+-      <plugin>
+         <artifactId>maven-enforcer-plugin</artifactId>
+         <executions>
+           <execution>
diff --git a/maven-eclipse-plugin.spec b/maven-eclipse-plugin.spec
index f7b33b7..fba0255 100644
--- a/maven-eclipse-plugin.spec
+++ b/maven-eclipse-plugin.spec
@@ -1,30 +1,15 @@
 Name:           maven-eclipse-plugin
 Version:        2.8
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        Maven Eclipse Plugin
 
 Group:          Development/Libraries
 License:        ASL 2.0
 URL:            http://maven.apache.org/plugins/maven-eclipse-plugin/
-# svn export http://svn.apache.org/repos/asf/maven/plugins/tags/maven-eclipse-plugin-2.8 maven-eclipse-plugin
-# tar czf maven-eclipse-plugin-2.8.tgz maven-eclipse-plugin
-Source0:        maven-eclipse-plugin-2.8.tgz
-Source1:        %{name}-depmap.xml
-
-# NOTE: Patch0 is used for three purposes: 
-# 1. Bypass maven version check
-# 2. Bypass the post-integration-test goal
-# 3. Use the newer eclipse resources version that we have in rawhide.
-# 1 and 2 should be fixed in the future  
-# FIXME: It needs maven > 2.0.9 for unit testing, because we don't have it yet, 
-# so we should patch the pom to bypass enforcer firstly. The should be removed
-# when the maven 2.2 bootstrap is done in rawhide
-Patch0:        %{name}-pom.patch
-# FIXME: The highest version of plexus-resources is a4, but we need a7.
-# In a7, the same API throw an extra IOException, the patch is tested to be 
-# safe. But it should be removed when a7 is ready. 
-Patch1:        %{name}-install-plugin-mojo.patch
-Patch2:        kill-bsh.patch
+Source0:        http://repo1.maven.org/maven2/org/apache/maven/plugins/%{name}/%{version}/%{name}-%{version}-source-release.zip
+Patch0:         add_compat.patch
+Patch1:         reduced_exception.patch
+Patch2:         kill-bsh.patch
 
 BuildArch: noarch
 
@@ -73,8 +58,6 @@ Requires: plexus-resources
 Requires: jpackage-utils
 Requires: jsch
 Requires: jtidy
-Requires(post): jpackage-utils
-Requires(postun): jpackage-utils
 
 Provides:       maven2-plugin-eclipse = 0:%{version}-%{release}
 Obsoletes:      maven2-plugin-eclipse <= 0:2.0.8
@@ -93,19 +76,15 @@ API documentation for %{name}.
 
 
 %prep
-%setup -q -n %{name}
+%setup -q 
+%patch0
 %patch1
-sed -i -e "s|3.3.0-v20070604|3.7.100.v20110510-0712|g" pom.xml
 %patch2
+sed -i -e "s|3.3.0-v20070604|3.7.100.v20110510-0712|g" pom.xml
 
 %build
 export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
 
-# The depmap is used by the mvn-jpp command to convert dependencies
-# to the locations and versions that are available (if needed)
-cp %{SOURCE1} %{name}-depmap.xml
-export MAVEN_DEPMAP=$(pwd)/%{name}-depmap.xml
-
 CORE_FAKE_VERSION="3.7.100.v20110510-0712"
 CORE_PLUGIN_DIR=$MAVEN_REPO_LOCAL/org/eclipse/core/resources/$CORE_FAKE_VERSION
 
@@ -116,35 +95,24 @@ ln -s "$plugin_file" $CORE_PLUGIN_DIR/resources-$CORE_FAKE_VERSION.jar
 
 mvn-rpmbuild -e \
         -Dmaven.test.skip=true \
-        -Dmaven.local.depmap.file=${MAVEN_DEPMAP} \
         -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
         install javadoc:javadoc
 
 %install
 # jars
 install -d -m 0755 %{buildroot}%{_javadir}
-install -m 644 target/%{name}-%{version}.jar   %{buildroot}%{_javadir}/%{name}-%{version}.jar
-
-(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; \
-    do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
-
-%add_to_maven_depmap org.apache.maven.plugins maven-eclipse-plugin %{version} JPP maven-eclipse-plugin
+install -m 644 target/%{name}-%{version}.jar   %{buildroot}%{_javadir}/%{name}.jar
 
 # poms
 install -d -m 755 %{buildroot}%{_mavenpomdir}
-install -pm 644 pom.xml \
-    %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
+install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
+
+%add_maven_depmap JPP-%{name}.pom %{name}.jar
 
 # javadoc
 install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}
 cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}/
 
-%post
-%update_maven_depmap
-
-%postun
-%update_maven_depmap
-
 %files
 %{_javadir}/*
 %{_mavenpomdir}/*
@@ -154,6 +122,9 @@ cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}/
 %{_javadocdir}/%{name}
 
 %changelog
+* Mon Dec 5 2011 Alexander Kurtakov <akurtako at redhat.com> 2.8-6
+- Fix build in pure maven 3 environment.
+
 * Fri Jun 17 2011 Alexander Kurtakov <akurtako at redhat.com> 2.8-5
 - Build with maven 3.x.
 
diff --git a/reduced_exception.patch b/reduced_exception.patch
new file mode 100644
index 0000000..670c6f6
--- /dev/null
+++ b/reduced_exception.patch
@@ -0,0 +1,46 @@
+--- src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java.sav	2010-02-22 02:02:12.000000000 +0200
++++ src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java	2011-12-05 23:38:30.132320878 +0200
+@@ -545,8 +545,6 @@ public abstract class AbstractIdeSupport
+ 
+                     ArtifactResolutionResult artifactResolutionResult = null;
+ 
+-                    try
+-                    {
+ 
+                         List listeners = new ArrayList();
+ 
+@@ -561,21 +559,6 @@ public abstract class AbstractIdeSupport
+                             artifactCollector.collect( getProjectArtifacts(), project.getArtifact(), managedVersions,
+                                                        localRepo, project.getRemoteArtifactRepositories(),
+                                                        getArtifactMetadataSource(), null, listeners );
+-                    }
+-                    catch ( ArtifactResolutionException e )
+-                    {
+-                        getLog().debug( e.getMessage(), e );
+-                        getLog().error(
+-                                        Messages.getString( "AbstractIdeSupportMojo.artifactresolution", new Object[] { //$NON-NLS-1$
+-                                                            e.getGroupId(), e.getArtifactId(), e.getVersion(),
+-                                                                e.getMessage() } ) );
+-
+-                        // if we are here artifactResolutionResult is null, create a project without dependencies but
+-                        // don't fail
+-                        // (this could be a reactor projects, we don't want to fail everything)
+-                        // Causes MECLIPSE-185. Not sure if it should be handled this way??
+-                        return new IdeDependency[0];
+-                    }
+ 
+                     // keep track of added reactor projects in order to avoid duplicates
+                     Set emittedReactorProjectId = new HashSet();
+--- src/main/java/org/apache/maven/plugin/eclipse/InstallPluginsMojo.java.sav	2010-02-22 02:02:14.000000000 +0200
++++ src/main/java/org/apache/maven/plugin/eclipse/InstallPluginsMojo.java	2011-12-05 23:45:06.631581161 +0200
+@@ -407,10 +407,6 @@ public class InstallPluginsMojo
+             {
+                 throw new MojoExecutionException( "Could not extract: " + artifactFile, e );
+             }
+-            catch ( IOException e )
+-            {
+-                throw new MojoExecutionException( "Could not extract: " + artifactFile, e );
+-            }
+         }
+     }
+ 
diff --git a/sources b/sources
index 2f9c07c..0bfd9a8 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-dd055eeca34e45dd961193c5e6940c97  maven-eclipse-plugin-2.8.tgz
+95f33b7bf0e902d18253b707001787fb  maven-eclipse-plugin-2.8-source-release.zip


More information about the scm-commits mailing list