Blob Blame History Raw
%global project_version 1.0-beta-4

Name:           buildnumber-maven-plugin
Version:        1.0
Release:        0.7.b4%{?dist}
Summary:        Build Number Maven Plugin

Group:          Development/Libraries
License:        MIT
# svn export http://svn.codehaus.org/mojo/tags/buildnumber-maven-plugin-1.0-beta-4 buildnumber-maven-plugin
URL:            http://svn.codehaus.org/mojo/tags/buildnumber-maven-plugin-1.0-beta-4

# tar czf buildnumber-maven-plugin-1.0-beta-4.tgz buildnumber-maven-plugin
Source0:        buildnumber-maven-plugin-1.0-beta-4.tgz
Source1:        %{name}-depmap.xml

Patch0:  %{name}-pom.patch
Patch1:  fix-build-and-remove-changes-plugin.patch

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: maven2-plugin-idea
BuildRequires: maven2-plugin-resources
BuildRequires: maven-compiler-plugin
BuildRequires: maven-install-plugin
BuildRequires: maven2-plugin-javadoc
BuildRequires: maven-jar-plugin
BuildRequires: maven2-plugin-enforcer
BuildRequires: maven2-plugin-invoker
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: svnkit
BuildRequires: jna

Requires: java
Requires: maven2
Requires: jna
Requires: svnkit
Requires: jpackage-utils
Requires(post): jpackage-utils
Requires(postun): jpackage-utils

%description
This mojo is designed to get a unique build number for each time you build 
your project. So while your version may remain constant at 1.0-SNAPSHOT 
for many iterations until release, you will have a build number that can 
uniquely identify each build during that time. The build number is obtained 
from scm, and in particular, at this time, from svn. You can then place that 
build number in metadata, which can be accessed from your app, if desired.

The mojo also has a couple of extra functions to ensure you get the proper 
build number. First, your local repository is checked to make sure it is 
up to date. Second, your local repository is automatically updated, so that 
you get the latest build number. Both these functions can be suppressed, 
if desired.

Optionally, you can configure this mojo to produce a revision based on a 
timestamp, or on a sequence, without requiring any interaction with an 
SCM system. Note that currently, the only supported SCM is subversion.


%package javadoc
Group:          Documentation
Summary:        Javadoc for %{name}
Requires:       jpackage-utils

%description javadoc
API documentation for %{name}.

%prep
%setup -q -n %{name}

%patch0 -p0
%patch1

%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 \
        -Dmaven2.jpp.mode=true \
        -Dmaven2.jpp.depmap.file=${MAVEN_DEPMAP} \
        -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
        -Dmaven.test.skip=true \
        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 *-%{project_version}*; \
    do ln -sf ${jar} `echo $jar| sed "s|-%{project_version}||g"`; done)

%add_to_maven_depmap org.codehaus.mojo buildnumber-maven-plugin %{project_version} JPP buildnumber-maven-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,-)
%doc LICENSE.txt README.TXT
%{_javadir}/*
%{_mavenpomdir}/*
%{_mavendepmapfragdir}/*

%files javadoc
%defattr(-,root,root,-)
%{_javadocdir}/%{name}-%{project_version}
%{_javadocdir}/%{name}

%changelog
* Thu Jun 17 2010 Alexander Kurtakov <akurtako@redhat.com> 1.0-0.7.b4
- Disable it-tests and changes plugin.

* Thu Jun 17 2010 Alexander Kurtakov <akurtako@redhat.com> 1.0-0.6.b4
- Skip tests to be able to rebuild.

* Thu Jun 17 2010 Alexander Kurtakov <akurtako@redhat.com> 1.0-0.5.b4
- Add missing requires.

* Thu May 27 2010 Weinan Li <weli@redhat.com> - 1.0-0.4.b4
- License.txt and Readme.txt added as %doc

* Thu May 27 2010 Weinan Li <weli@redhat.com> - 1.0-0.3.b4
- Fix javadoc dangling-relative-symlink

* Wed May 26 2010 Weinan Li <weli@redhat.com> - 1.0-0.2.b4
- Add requires on jpackage-utils for javadoc subpackage
- Add standard jpackage-utils requires on main package
- Use global instead of define
- Fix license to MIT
- fix incoherent-version-in-changelog

* Mon May 24 2010 Weinan Li <weli@redhat.com> - 1.0-0.1.b4
- Initial package