Add conditionals for building without OBR or Maven reports

This commit is contained in:
Mikolaj Izdebski 2016-10-13 11:50:54 +02:00
parent 9cfbbf6702
commit 02f3adc0c0
5 changed files with 152 additions and 20 deletions

View File

@ -1,13 +1,27 @@
From 1d3e098ac5d020a7e93b942782c95ca42def50cb Mon Sep 17 00:00:00 2001
From b173320e3dca5637136055427829a4f7198838d4 Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com>
Date: Fri, 12 Feb 2016 09:45:20 +0100
Subject: [PATCH 1/3] Port to current maven-dependency-tree
Subject: [PATCH 1/4] Port to current maven-dependency-tree
---
pom.xml | 2 +-
.../apache/felix/bundleplugin/BundleAllPlugin.java | 54 ++++++++++++----------
.../apache/felix/bundleplugin/BundlePlugin.java | 30 ++++++------
2 files changed, 45 insertions(+), 39 deletions(-)
3 files changed, 46 insertions(+), 40 deletions(-)
diff --git a/pom.xml b/pom.xml
index d3ec096..db1134f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -187,7 +187,7 @@
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-dependency-tree</artifactId>
- <version>2.1</version>
+ <version>3.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
diff --git a/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java b/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
index 5d095d8..b32b90b 100644
--- a/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java

View File

@ -1,7 +1,7 @@
From d79e608dfbaf74574dea1d1e1b8e5a249aa8019a Mon Sep 17 00:00:00 2001
From 8e244ca6810e4e4d93e21e63c9d83e815c2e403d Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Thu, 14 Apr 2016 17:00:23 +0100
Subject: [PATCH 2/3] Fix for new maven archiver
Subject: [PATCH 2/4] Fix for new maven archiver
---
src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java | 2 +-

View File

@ -1,12 +1,26 @@
From 0110a0dc8c3559b4a0a5c88c9883a07bef605233 Mon Sep 17 00:00:00 2001
From 82bf76df538a57f823499e613aba13876429d651 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Thu, 12 May 2016 09:24:36 +0200
Subject: [PATCH 3/3] Port to plexus-utils 3.0.24
Subject: [PATCH 3/4] Port to plexus-utils 3.0.24
---
pom.xml | 2 +-
src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index db1134f..8749fdd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -192,7 +192,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
- <version>3.0.10</version>
+ <version>3.0.24</version>
</dependency>
<dependency>
<groupId>org.sonatype.plexus</groupId>
diff --git a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index dcf3978..8ddf111 100644
--- a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java

View File

@ -0,0 +1,77 @@
From 971aaa7a15ac327c83bd3ce34d08c4d72fc074d0 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Wed, 12 Oct 2016 23:43:00 +0200
Subject: [PATCH 4/4] Use Maven 3 APIs
---
pom.xml | 17 +++++++++++------
.../org/apache/felix/bundleplugin/BundlePlugin.java | 4 ++--
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8749fdd..6deaf4f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -177,7 +177,17 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
- <version>2.2.0</version>
+ <version>3.3.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-compat</artifactId>
+ <version>3.3.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.reporting</groupId>
+ <artifactId>maven-reporting-impl</artifactId>
+ <version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
@@ -221,11 +231,6 @@
<version>1.1</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.jdom</groupId>
- <artifactId>jdom</artifactId>
- <version>1.1</version>
- </dependency>
</dependencies>
<reporting>
diff --git a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index 8ddf111..da41aa1 100644
--- a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -46,7 +46,6 @@ import java.util.TreeMap;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
-import org.apache.felix.bundleplugin.pom.PomWriter;
import org.apache.maven.archiver.ManifestSection;
import org.apache.maven.archiver.MavenArchiveConfiguration;
import org.apache.maven.archiver.MavenArchiver;
@@ -63,6 +62,7 @@ import org.apache.maven.model.Exclusion;
import org.apache.maven.model.License;
import org.apache.maven.model.Model;
import org.apache.maven.model.Resource;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -864,7 +864,7 @@ public class BundlePlugin extends AbstractMojo
try
{
- PomWriter.write( w, model, true );
+ new MavenXpp3Writer().write( w, model );
}
finally
{
--
2.7.4

View File

@ -1,8 +1,13 @@
%if 0%{?fedora}
%bcond_with obr
%bcond_without reporting
%endif
%global site_name maven-bundle-plugin
Name: maven-plugin-bundle
Version: 3.2.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Maven Bundle Plugin
License: ASL 2.0
URL: http://felix.apache.org
@ -16,29 +21,33 @@ Patch0: 0001-Port-to-current-maven-dependency-tree.patch
Patch1: 0002-Fix-for-new-maven-archiver.patch
# Port to newer Plexus utils
Patch2: 0003-Port-to-plexus-utils-3.0.24.patch
# Port to newer Maven
Patch3: 0004-Use-Maven-3-APIs.patch
BuildRequires: maven-local
BuildRequires: mvn(biz.aQute.bnd:biz.aQute.bndlib)
BuildRequires: mvn(net.sf.kxml:kxml2)
BuildRequires: mvn(org.apache.felix:felix-parent:pom:)
BuildRequires: mvn(org.apache.felix:org.apache.felix.bundlerepository)
BuildRequires: mvn(org.apache.felix:org.apache.felix.utils)
BuildRequires: mvn(org.apache.maven.doxia:doxia-core)
BuildRequires: mvn(org.apache.maven.doxia:doxia-sink-api)
BuildRequires: mvn(org.apache.maven.doxia:doxia-site-renderer)
BuildRequires: mvn(org.apache.maven:maven-archiver)
BuildRequires: mvn(org.apache.maven:maven-compat)
BuildRequires: mvn(org.apache.maven:maven-core)
BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin)
BuildRequires: mvn(org.apache.maven.plugin-tools:maven-plugin-annotations)
BuildRequires: mvn(org.apache.maven.reporting:maven-reporting-impl)
BuildRequires: mvn(org.apache.maven.shared:maven-dependency-tree)
BuildRequires: mvn(org.codehaus.plexus:plexus-utils)
BuildRequires: mvn(org.jdom:jdom)
BuildRequires: mvn(org.osgi:osgi.core)
BuildRequires: mvn(org.sonatype.plexus:plexus-build-api)
%if %{with obr}
BuildRequires: mvn(net.sf.kxml:kxml2)
BuildRequires: mvn(org.apache.felix:org.apache.felix.bundlerepository)
BuildRequires: mvn(xpp3:xpp3)
%endif
%if %{with reporting}
BuildRequires: mvn(org.apache.maven.doxia:doxia-core)
BuildRequires: mvn(org.apache.maven.doxia:doxia-sink-api)
BuildRequires: mvn(org.apache.maven.doxia:doxia-site-renderer)
BuildRequires: mvn(org.apache.maven.reporting:maven-reporting-impl)
%endif
%description
Provides a maven plugin that supports creating an OSGi bundle
@ -57,21 +66,36 @@ API documentation for %{name}.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
find -name '*.jar' -delete
%pom_change_dep :org.osgi.core :osgi.core
# Bundled class from old maven-dependency-tree
rm -r src/main/java/org/apache/maven/shared/dependency
# Bundled classes from old maven
rm -r src/main/java/org/apache/felix/bundleplugin/pom
# There is forked version of maven-osgi in
# src/{main,test}/java/org/apache/maven
%pom_add_dep org.apache.maven:maven-compat
%if %{with obr}
# Deps unbundled from felix-bundlerepository
%pom_add_dep xpp3:xpp3
%pom_add_dep net.sf.kxml:kxml2
%pom_add_dep org.apache.maven.reporting:maven-reporting-impl
%else
rm -rf src/main/java/org/apache/felix/obrplugin/
%pom_remove_dep :org.apache.felix.bundlerepository
%endif
%pom_change_dep :org.osgi.core :osgi.core
%if %{without reporting}
rm -f src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java
%pom_remove_dep :doxia-sink-api
%pom_remove_dep :doxia-site-renderer
%pom_remove_dep :maven-reporting-impl
%endif
%build
# Tests depend on bundled JARs
@ -87,6 +111,9 @@ rm -r src/main/java/org/apache/maven/shared/dependency
%doc LICENSE NOTICE
%changelog
* Wed Oct 12 2016 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.2.0-3
- Add conditionals for building without OBR or Maven reports
* Thu Oct 06 2016 Michael Simacek <msimacek@redhat.com> - 3.2.0-2
- Use osgi APIs instead of felix-framework