This is a recipe for conversion of current mvn-rpmbuild spec file into xmvn style spec file.
In this recipe we'll show how to convert Maven projects using following keywords:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | %global parent plexus %global dirhash 56a0f9b Name: plexus-compiler Version: 1.9.2 Release: 3%{?dist} Epoch: 0 Summary: Compiler call initiators for Plexus # extras subpackage has a bit different licensing # parts of compiler-api are ASL2.0/MIT License: MIT and ASL 2.0 Group: Development/Java URL: http://plexus.codehaus.org/ Source0: https://github.com/sonatype/%{name}/tarball/%{name}-%{version}#/%{name}-%{version}.tar.gz Patch0: plexus-compiler-ignoreOptionalProblems.patch BuildArch: noarch BuildRequires: maven BuildRequires: jpackage-utils BuildRequires: junit BuildRequires: classworlds BuildRequires: eclipse-ecj BuildRequires: plexus-containers-container-default BuildRequires: plexus-utils BuildRequires: plexus-containers-component-metadata BuildRequires: junit4 BuildRequires: plexus-pom Requires: classworlds Requires: plexus-containers-container-default Requires: plexus-utils Requires: junit4 %description Plexus Compiler adds support for using various compilers from a unified api. Support for javac is available in main package. For additional compilers see %{name}-extras package. %package extras Summary: Extra compiler support for %{name} Group: Development/Libraries # ASL 2.0: src/main/java/org/codehaus/plexus/compiler/util/scan/ # ...codehaus/plexus/compiler/csharp/CSharpCompiler.java # ASL 1.1/MIT: ...codehaus/plexus/compiler/jikes/JikesCompiler.java License: MIT and ASL 2.0 and ASL 1.1 Requires: jpackage-utils Requires: eclipse-ecj Requires: %{name} = %{version}-%{release} %description extras Additional support for csharp, eclipse and jikes compilers %package javadoc Summary: Javadoc for %{name} Group: Documentation Requires: jpackage-utils %description javadoc API documentation for %{name}. %prep %setup -q -n sonatype-plexus-compiler-%{dirhash} %patch0 -p1 %pom_disable_module plexus-compiler-aspectj plexus-compilers/pom.xml # don't build/install compiler-test module, it needs maven2 test harness %pom_disable_module plexus-compiler-test %build mvn-rpmbuild -e \ -Dmaven.test.skip=true \ install javadoc:aggregate %install # jars install -d -m 755 %{buildroot}%{_javadir}/%{parent} install -d -m 755 %{buildroot}%{_mavenpomdir} for mod in plexus-compiler-{api,manager}; do jarname=${mod/plexus-} install -pm 644 $mod/target/${mod}-%{version}.jar \ %{buildroot}%{_javadir}/%{parent}/$jarname.jar install -pm 644 $mod/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{parent}-$jarname.pom %add_maven_depmap JPP.%{parent}-$jarname.pom %{parent}/$jarname.jar done pushd plexus-compilers for mod in plexus-compiler-{csharp,eclipse,jikes,javac}; do jarname=${mod/plexus-} install -pm 644 $mod/target/${mod}-%{version}.jar \ %{buildroot}%{_javadir}/%{parent}/$jarname.jar install -pm 644 $mod/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{parent}-$jarname.pom %add_maven_depmap JPP.%{parent}-$jarname.pom %{parent}/$jarname.jar -f extras done install -pm 644 plexus-compiler-javac/target/plexus-compiler-javac-%{version}.jar \ %{buildroot}%{_javadir}/%{parent}/compiler-javac.jar install -pm 644 plexus-compiler-javac/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{parent}-compiler-javac.pom %add_maven_depmap JPP.%{parent}-compiler-javac.pom %{parent}/compiler-javac.jar install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{parent}-compilers.pom %add_maven_depmap JPP.%{parent}-compilers.pom popd install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{parent}-compiler.pom %add_maven_depmap JPP.%{parent}-compiler.pom # javadocs install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name} cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name} %pre javadoc # workaround for rpm bug, can be removed in F-17 [ $1 -gt 1 ] && [ -L %{_javadocdir}/%{name} ] && \ rm -rf $(readlink -f %{_javadocdir}/%{name}) %{_javadocdir}/%{name} || : %files # see custom package layout in notable differences %{_javadir}/%{parent}/compiler-api.jar # see custom package layout in notable differences %{_javadir}/%{parent}/compiler-manager.jar # see custom package layout in notable differences %{_javadir}/%{parent}/compiler-javac.jar # see custom package layout in notable differences %{_mavenpomdir}/JPP.%{parent}-compilers.pom # see custom package layout in notable differences %{_mavenpomdir}/JPP.%{parent}-compiler.pom # see custom package layout in notable differences %{_mavenpomdir}/JPP.%{parent}-compiler-api.pom # see custom package layout in notable differences %{_mavenpomdir}/JPP.%{parent}-compiler-manager.pom # see custom package layout in notable differences %{_mavenpomdir}/JPP.%{parent}-compiler-javac.pom # see custom package layout in notable differences %{_mavendepmapfragdir}/%{name} # see custom package layout in notable differences %files extras # see custom package layout in notable differences %{_mavendepmapfragdir}/%{name}-extras # see custom package layout in notable differences %{_javadir}/%{parent}/compiler-csharp.jar # see custom package layout in notable differences %{_javadir}/%{parent}/compiler-eclipse.jar # see custom package layout in notable differences %{_javadir}/%{parent}/compiler-jikes.jar # see custom package layout in notable differences %{_mavenpomdir}/JPP.%{parent}-compiler-jikes.pom # see custom package layout in notable differences %{_mavenpomdir}/JPP.%{parent}-compiler-eclipse.pom # see custom package layout in notable differences %{_mavenpomdir}/JPP.%{parent}-compiler-csharp.pom # see custom package layout in notable differences %files javadoc # see custom package layout in notable differences %doc %{_javadocdir}/%{name} # see custom package layout in notable differences %changelog * Wed Dec 5 2012 Michal Srb <msrb@redhat.com> - 0:1.9.2-3 - Replaced dependency to plexus-container-default with plexus-containers-container-default - Fix up licensing properly |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | %global parent plexus %global dirhash 16e340d Name: plexus-compiler Version: 2.1 Release: 1%{?dist} Epoch: 0 Summary: Compiler call initiators for Plexus # extras subpackage has a bit different licensing # parts of compiler-api are ASL2.0/MIT License: MIT and ASL 2.0 Group: Development/Java URL: http://plexus.codehaus.org/ Source0: https://github.com/sonatype/%{name}/tarball/%{name}-%{version}#/%{name}-%{version}.tar.gz BuildArch: noarch BuildRequires: maven BuildRequires: jpackage-utils BuildRequires: junit BuildRequires: classworlds BuildRequires: eclipse-ecj BuildRequires: plexus-containers-container-default BuildRequires: plexus-utils BuildRequires: plexus-containers-component-metadata BuildRequires: junit4 BuildRequires: plexus-pom %description Plexus Compiler adds support for using various compilers from a unified api. Support for javac is available in main package. For additional compilers see %{name}-extras package. %package extras Summary: Extra compiler support for %{name} # ASL 2.0: src/main/java/org/codehaus/plexus/compiler/util/scan/ # ...codehaus/plexus/compiler/csharp/CSharpCompiler.java # ASL 1.1/MIT: ...codehaus/plexus/compiler/jikes/JikesCompiler.java License: MIT and ASL 2.0 and ASL 1.1 %description extras Additional support for csharp, eclipse and jikes compilers %package pom Summary: Maven POM files for %{name} %description pom This package provides %{summary}. %package javadoc Summary: Javadoc for %{name} Group: Documentation %description javadoc API documentation for %{name}. %prep %setup -q -n sonatype-plexus-compiler-%{dirhash} %pom_disable_module plexus-compiler-aspectj plexus-compilers/pom.xml # don't build/install compiler-test module, it needs maven2 test harness %pom_disable_module plexus-compiler-test %build %mvn_package ":plexus-compiler{,s}" pom # see custom package layout in notable differences %mvn_package ":*{csharp,eclipse,jikes}*" extras # see custom package layout in notable differences # Tests are skipped because of unavailable plexus-compiler-test artifact %mvn_build -f %install %mvn_install %files -f .mfiles %files extras -f .mfiles-extras %files pom -f .mfiles-pom %files javadoc %doc %{_javadocdir}/%{name} %changelog * Wed Jan 23 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 0:2.1-1 - Update to upstream version 2.1 - Build with xmvn |
plexus-compiler requires:
plexus-compiler-extras requires:
plexus-compiler-javadoc requires:
plexus-compiler requires:
plexus-compiler-pom requires:
plexus-compiler-extras requires:
plexus-compiler-javadoc requires:
mvn_package
macro takes two
arguments. First argument is an artifact, or list of artifacts
specified as groupId:artifactId
. groupId
can be ommited and
wildcards can be used. Second argument is name of the package in which
specified artifacts will end up. There is a special package named
__noinstall
. The artifacts from this package won't be installed
anywhere.