%global project_version 2.1-beta-1 Name: maven-war-plugin Version: 2.1 Release: 0.2.b1%{?dist} Summary: Maven WAR Plugin Group: Development/Libraries License: ASL 2.0 URL: http://maven.apache.org/plugins/maven-war-plugin/ #svn export http://svn.apache.org/repos/asf/maven/plugins/tags/maven-war-plugin-2.1-beta-1 maven-war-plugin #tar czf maven-war-plugin-2.1-beta-1.tgz maven-war-plugin Source0: maven-war-plugin-2.1-beta-1.tgz Source1: %{name}-depmap.xml BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # Basic stuff BuildRequires: jpackage-utils BuildRequires: java-devel >= 1:1.6.0 # Maven and its dependencies BuildRequires: maven2 BuildRequires: maven-plugin-plugin BuildRequires: maven-javadoc-plugin BuildRequires: maven-jar-plugin BuildRequires: maven-doxia BuildRequires: maven-doxia-tools BuildRequires: maven-doxia-sitetools BuildRequires: maven-surefire-provider-junit BuildRequires: maven-surefire-maven-plugin BuildRequires: maven-plugin-cobertura BuildRequires: maven-shared-filtering BuildRequires: maven-enforcer-plugin BuildRequires: maven-compiler-plugin BuildRequires: maven-install-plugin BuildRequires: maven2-plugin-idea BuildRequires: maven2-plugin-resources BuildRequires: maven2-plugin-changes BuildRequires: maven2-plugin-invoker # Others BuildRequires: xstream Requires: java Requires: maven2 Requires: xstream Requires: jpackage-utils Requires(post): jpackage-utils Requires(postun): jpackage-utils Provides: maven2-plugin-war = 0:%{version}-%{release} Obsoletes: maven2-plugin-war <= 0:2.0.8 %description Builds a Web Application Archive (WAR) file from the project output and its dependencies. %package javadoc Group: Documentation Summary: Javadoc for %{name} Requires: jpackage-utils %description javadoc API documentation for %{name}. %prep %setup -q -n %{name} %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 mvn-jpp \ -e \ -Dmaven.test.skip=true \ -Dmaven2.jpp.mode=true \ -Dmaven2.jpp.depmap.file=${MAVEN_DEPMAP} \ -Dmaven.repo.local=$MAVEN_REPO_LOCAL \ install javadoc:javadoc %install rm -rf %{buildroot} # jars install -d -m 0755 %{buildroot}%{_javadir} install -m 644 target/%{name}-%{project_version}.jar %{buildroot}%{_javadir}/%{name}-%{project_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-war-plugin %{version} JPP maven-war-plugin # poms install -d -m 755 %{buildroot}%{_mavenpomdir} install -pm 644 pom.xml \ %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom # javadoc install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}-%{project_version} cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}-%{project_version}/ ln -s %{name}-%{project_version} %{buildroot}%{_javadocdir}/%{name} rm -rf target/site/api* %post %update_maven_depmap %postun %update_maven_depmap %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %{_javadir}/* %{_mavenpomdir}/* %{_mavendepmapfragdir}/* %files javadoc %defattr(-,root,root,-) %{_javadocdir}/%{name}-%{project_version} %{_javadocdir}/%{name} %changelog * Mon Jun 7 2010 Weinan Li - 2.1-0.2.b1 - Fix incoherent version in changelog * Thu Jun 3 2010 Weinan Li - 2.1-0.1.b1 - Initial Package