diff --git a/glassfish-hk2.spec b/glassfish-hk2.spec
index 3cf9305..865c733 100644
--- a/glassfish-hk2.spec
+++ b/glassfish-hk2.spec
@@ -261,9 +261,6 @@ find ./ -name "*.java" -exec sed -i "s/org.glassfish.hk2.external.org.objectweb.
%pom_remove_plugin -r :jacoco-maven-plugin
%pom_remove_dep -r :jacoco-maven-plugin
-# fix build failure. 'useDefaultManifestFile' has been removed from the maven-jar-plugin >= 3.0.0
-%pom_remove_plugin :maven-jar-plugin
-
%pom_disable_module external
%pom_disable_module examples
# Use unavailable: org.ops4j.pax.exam, org.ops4j.pax.url
@@ -346,6 +343,66 @@ cp -p %SOURCE2 hk2-inhabitant-generator/osgi.bundle
"
+# fix build failure. 'useDefaultManifestFile' has been removed from the maven-jar-plugin >= 3.0.0
+%pom_xpath_remove "pom:plugin[pom:artifactId = 'maven-jar-plugin']/pom:configuration/pom:useDefaultManifestFile"
+%pom_xpath_inject "pom:plugin[pom:artifactId = 'maven-jar-plugin']/pom:configuration" "
+ \${project.build.outputDirectory}/META-INF/MANIFEST.MF"
+%pom_xpath_remove "pom:plugin[pom:artifactId = 'maven-bundle-plugin']/pom:configuration"
+%pom_xpath_inject "pom:plugin[pom:artifactId = 'maven-bundle-plugin']" "
+true
+
+
+ bundle-manifest
+ process-classes
+
+ manifest
+
+
+"
+%pom_remove_plugin :maven-jar-plugin osgi-resource-locator
+%pom_xpath_remove "pom:plugin[pom:artifactId = 'maven-jar-plugin']/pom:configuration/pom:useDefaultManifestFile" hk2-utils
+%pom_xpath_inject "pom:plugin[pom:artifactId = 'maven-jar-plugin']/pom:configuration" "
+ \${project.build.outputDirectory}/META-INF/MANIFEST.MF" hk2-utils
+for m in class-model \
+ guice-bridge \
+ hk2 \
+ hk2-api \
+ hk2-configuration/hk2-integration \
+ hk2-configuration/manager \
+ hk2-configuration/persistence/hk2-xml/main \
+ hk2-configuration/persistence/hk2-xml/test1 \
+ hk2-configuration/persistence/hk2-xml-dom/config-types \
+ hk2-configuration/persistence/hk2-xml-dom/hk2-config \
+ hk2-configuration/persistence/hk2-xml-dom/hub-integration \
+ hk2-configuration/persistence/property-file \
+ hk2-core \
+ hk2-extras \
+ hk2-jmx \
+ hk2-locator \
+ hk2-runlevel \
+ hk2-testing/collections \
+ hk2-testing/hk2-junitrunner \
+ hk2-testing/hk2-locator-extras \
+ hk2-testing/hk2-locator-no-proxies \
+ hk2-testing/hk2-locator-no-proxies2 \
+ hk2-utils \
+ osgi/adapter \
+ osgi/adapter-tests/faux-sdp-bundle \
+ osgi/adapter-tests/sdp-management-bundle \
+ osgi-resource-locator \
+ spring-bridge
+do
+ %pom_xpath_inject "pom:project" "bundle" ${m}
+ %pom_xpath_inject "pom:plugin[pom:artifactId = 'maven-bundle-plugin']" "true" ${m}
+done
+for m in osgi/adapter-tests/contract-bundle \
+ osgi/adapter-tests/no-hk2-bundle \
+ osgi/adapter-tests/test-module-startup
+do
+ %pom_xpath_set "pom:project/pom:packaging" bundle ${m}
+ %pom_xpath_inject "pom:plugin[pom:artifactId = 'maven-bundle-plugin']" "true" ${m}
+done
+
cp -p %{SOURCE1} LICENSE.txt
sed -i 's/\r//' LICENSE.txt