[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: maven packaging



To add jars to maven repo when the build system is not Maven, use the
tools provided by maven-repo-helper. There is a tutorial here:

file:///usr/share/doc/maven-repo-helper/tutorial.html

Ludovic

On 28/01/2012 01:20, ribalkin@gmail.com wrote:
> Thank you, my bad.
> One more question:
> What is the right way of adding jar to maven repo for existing ant based
> package?
> 
> -- 
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
> 
> Ludovic Claude <ludovic.claude@laposte.net> wrote:
> 
>     Hello Boris,
> 
>     You should not try to package only a module of this project
>     (google-http-client) but the whole project, then select which modules
>     you want to include and maybe split the final binaries into several
>     packages.
> 
>     So in short do the following:
> 
>     hg clone https://code.google.com/p/google-http-java-client/
>     cd google-http-java-client
>     hg update 1.6
>     mh_make
>     [...]
>     This project contains modules. Include all modules?
>     [y]/n > n
>     Analysing google-http-client/pom.xml...
>     Include the module google-http-client/pom.xml ?
>     [y]/n > y
> 
>     This is required because the parent POM located at the root of the
>     project contains important information such as the versions for the
>     dependencies. This quite usual in Maven projects and considered
>     best
>     practice.
> 
>     Ludovic
> 
>     On 21/01/2012 04:05, Boris Ribalkin wrote:
>     > Hi,
>     > 
>     > One more question on mh_make.
>     > I am trying to package google-http-client
>     > (https://google-http-java-client.googlecode.com/hg/google-http-client/pom.xml)
>     > which depends on com.google.code.gson
>     > (http://google-gson.googlecode.com/svn/tags/gson-2.1/). So I packaged
>     > gson first and it was fine, but when I run mh_make on google-http-client
>     > it says the following:
>     > 
>     >     This dependency cannot be found in the Debian Maven repository.
>     >     Ignore this dependency?
>     >       com.google.code.gson:gson:jar:null
>     >     y/[n] >
>     >     > dpkg --search /usr/share/maven-repo/com/google/code/gson/gson
>     &
>      gt;    
>     *Found libgson-java*
>     >     > dpkg --status libgson-java
>     >     [error] Package libgson-java (2.1-1) is already installed and
>     >     contains a possible match,
>     >     but I cannot resolve library com.google.code.gson:gson:jar:*null* in it.
>     >     [error] Please check manually that the library is up to date,
>     >     otherwise it may be necessary to package version null in Debian.
>     >     Try again to resolve the dependency?
>     >     [y]/n >
>     >     Rescanning /usr/share/maven-repo...
>     >     Resolving com.google.code.gson:gson:jar:null of scope runtime...
>     >     In pom.xml, cannot find the version for dependency
>     >     com.google.code.gson:gson:jar:null from this POM or its parent POMs
>     >     [warning] Option --no-parent has been set for POM file pom.xml,
>     >     maybe it was not a good idea and you should first package the parent
>     >     POM __super__:__pom__:pom:null
>     &
>      gt;    
>     [check dependency with bundle type]
>     >     > dpkg --status libgson-java
>     >     [error] Package libgson-java (2.1-1) is already installed and
>     >     contains a possible match,
>     >     but I cannot resolve library com.google.code.gson:gson:jar:null in it.
>     >     [error] Please check manually that the library is up to date,
>     >     otherwise it may be necessary to package version null in Debian.
>     >     Try again to resolve the dependency?
>     >     [y]/n >
>     > 
>     > 
>     > Is this because dependency has no version, but how then junit dependency
>     > is found if it has no version as well?
>     > What is the proper way of fixing this?
>     > 
>     > Thanks.
>     > 
>     > On Thu, Dec 8, 2011 at 9:17 PM, Boris Ribalkin <ribalkin@gmail.com
>     > <mailto:ribalkin@gmail.com>> wrote:
>     > 
>     >     Hi Ludovic,
>     > 
>     >     Actually I am the owner of the uclo
>      ud
>     project on github :) so I can
>     >     make any changes you suggested. Wil let you know if it will work.
>     > 
>     >     Thanks!
>     > 
>     >     On Dec 8, 2011 4:58 PM, "Ludovic Claude" <ludovic.claude@laposte.net
>     >     <mailto:ludovic.claude@laposte.net>> wrote:
>     > 
>     >         Hello Boris,
>     > 
>     >         It looks like you are almost there. Your project is hosted on
>     >         Github,
>     >         but I don't support yet Git, so the debian/watch used to find
>     >         the latest
>     >         version and get the upstream code is not generated by mh_make.
>     > 
>     >         However there are lots of other packages which get their sources
>     >         from
>     >         Github (basex, plexus-cipher, junit4, libjdom1-java), so you can
>     >         study
>     >         their packaging using apt-get source <package>.
>     > 
>     >         This watc
>      h file
>     should in theory get the latest release of uCloud,
>     >         expect that it does not...
>     > 
>     >         cat <<EOF > debian/watch
>     >         version=3
>     >         http://githubredir.debian.net/github/cyberb/uCloud/ (.*).tar.gz
>     >         EOF
>     > 
>     >         You should ask the project owner to tag in Git the latest release,
>     >         otherwise it's not possible to know what to download. Or better, he
>     >         should use maven-release-plugin to create a release of the project.
>     > 
>     >         After you get this detail sorted, then you should add those lines to
>     >         debian/rules:
>     > 
>     >         get-orig-source:
>     >                uscan --download-version $(DEB_UPSTREAM_VERSION)
>     >         --force-download --rename
>     > 
>     >         Finally, if you work on Ubuntu and use Laun
>      chpad,
>     then you
>     >         should store
>     >         your packaging in bzr:
>     > 
>     >         sudo apt-get install bzr-builddeb
>     >         bzr init
>     >         mkdir .bzr-builddeb/
>     >         echo -e '[BUILDDEB]\nmerge = True' > .bzr-builddeb/default.conf
>     >         bzr add .
>     > 
>     >         and you can build your package with
>     > 
>     >         bzr bd
>     > 
>     >         Well that's the usual procedure. In your case, since it's
>     >         difficult to
>     >         get the upstream sources, you need to download  them yourself
>     >         and put
>     >         them in a tar.gz file which you should call
>     >         ucloud_1.0.0.orig.tar.gz and
>     >         copy it in the parent directory. Doing so will make bzr bd / debuild
>     >         happy since they don't have to download the sources.
>     > 
>     >         Consider also joining the Debian Java team, as
>       it's
>     full of
>     >         active and
>     >         knowledgable developers
>     >         (http://wiki.debian.org/Teams/JavaPackaging).
>     >         Once your package is ready, you can ask to include it in Debian
>     >         and it
>     >         will land some time later into Ubuntu.
>     > 
>     >         Cheers,
>     >         Ludovic
>     > 
>     >         On 08/12/2011 07:31, Boris Ribalkin wrote:
>     >         > Hi,
>     >         >
>     >         > Thanks for the info, your new package is much better.
>     >         > After running mh_make in the root of my project, looks like
>     >         everything
>     >         > went fine, just one exception at the end:
>     >         >
>     >         >> Cannot recognize the download url
>     >         > (scm:git:https://github.com/cyberb/uCloud.git).
>     >         > I've tried different scm urls, but it is always the same, is
>     >         it OK?
>     >         >
>     >         > than I ran debuild and got the following error:
>     >         >
>     >         >> This package has a Debian revision number but there does not
>     >         seem to be
>     >         > an appropriate original tar file or .orig directory in the
>     >         parent directory;
>     >         > (expected one of ucloud_1.0.0.orig.tar.gz,
>     >         ucloud_1.0.0.orig.tar.bz2,
>     >         > ucloud_1.0.0.orig.tar.lzma,  ucloud_1.0.0.orig.tar.xz or
>     >         ucloud.orig)
>     >         > continue anyway? (y/n) y
>     >         >
>     >         > and then
>     >         >
>     >         >> dpkg-source: error: can't build with source format '3.0
>     >  
>            
>     (quilt)': no
>     >         > orig.tar file found
>     >         > dpkg-buildpackage: error: dpkg-source -b ucloud gave error
>     >         exit status 255
>     >         > debuild: fatal error at line 1348:
>     >         > dpkg-buildpackage -rfakeroot -D -us -uc failed
>     >         >
>     >         > Do you have any idea what is wrong?
>     >         >
>     >         > Thanks again for the help!
>     >         >
>     >         > On Tue, Dec 6, 2011 at 6:09 PM, Ludovic Claude
>     >         > <ludovic.claude@laposte.net
>     >         <mailto:ludovic.claude@laposte.net>
>     >         <mailto:ludovic.claude@laposte.net
>     >         <mailto:ludovic.claude@laposte.net>>> wrote:
>     >         >
>     >         >     Privet Boris,
>     >         >
>     >         >     Packaging a multi-module Maven project should be quite
>     >         easy now, 
>      as
>     you
>     >         >     can run Maven itself for the build and use
>     >         maven-debian-helper to
>     >         >     install the jars at the proper location. Of course you
>     >         need to have all
>     >         >     dependencies already packaged in Debian/Ubuntu.
>     >         >
>     >         >     I have written a tool which should assist you create the
>     >         packaging for a
>     >         >     Maven project, it's called mh_make and can be found in the
>     >         >     maven-debian-helper package. Here's an old wiki page which
>     >         explains how
>     >         >     to use it.
>     >         >
>     >         >     http://wiki.debian.org/Java/MavenDebianHelper
>     >         >
>     >         >     As it's still work in progress, there might be bugs but if
>     >         you're lucky
> 
>      >   
>          >     it will do most of the work for you. I'm interested in
>     >         your feedback of
>     >         >     course. You should install at least the latest
>     >         maven-repo-helper and
>     >         >     maven-debian-helper packages from my PPA with the command
>     >         >     sudo apt-add-repository ppa:ludovicc/ppa && sudo apt-get
>     >         update
>     >         >     sudo apt-get upgrade
>     >         >
>     >         >     Ludovic
>     >         >
>     >         >     On 06/12/2011 08:22, Boris Rybalkin wrote:
>     >         >     > Hi,
>     >         >     >
>     >         >     > As I see you are supporting multiple java packages on
>     >         launchpad, but I
>     >         >     > am trying to create my first.
>     >         >     > Could you help me a little with multi module maven based
>     >         project?
>     >  
>           >     > Just may be with some advices on where to go.
>     >         >     >
>     >         >     > I used to run "mvn package" which gives me (using
>     >         assembly plugin)
>     >         >     ready
>     >         >     > to use distribution folder with all the JARs and run
>     >         scripts. But
>     >         >     now I
>     >         >     > am thinking of creating PPA so I can share the app and
>     >         here I have
>     >         >     some
>     >         >     > problems
>     >         >     > My package recipe:
>     >         >     https://code.launchpad.net/~ribalkin/+recipe/ucloud-
>     >         <https://code.launchpad.net/%7Eribalkin/+recipe/ucloud-> <https://code.launchpad.net/%7Eribalkin/+recipe/ucloud->>;
>     >         >     <https://code.launchpad.net/%7Eribalkin/+recipe/ucloud-> <https://code.launchpad.net/%7Eribalkin/+recipe/ucloud->>;
>     >         >     > imported-daily
>     >         >     > I've red http://developer.ubuntu.com/packaging/html and
>     >         >     > http://wiki.debian.org/Java/MavenBuilder but it has no
>     >         details.
>     >         >     >
>     >         >     > Am I right that every maven module should be installed
>     >         as a separate
>     >         >     > java library during the build process
>     >         (mh_installpoms/mh_installjar)?
>     >         >     > Also even if I do so, I do not see in launchpad build
>     >         log that mvn
>     >         >     > package actually started for any of my module.
>     >         >     >
>     >
>             >     > Thank for any help!
>     >         >
>     >         >
>     >         >
>     >         >
>     >         > --
>     >         > Boris Rybalkin
>     >         > ribalkin@gmail.com <mailto:ribalkin@gmail.com>
>     >         <mailto:ribalkin@gmail.com <mailto:ribalkin@gmail.com>>
>     > 
>     > 
>     > 
>     > 
>     > -- 
>     > Boris Rybalkin
>     > ribalkin@gmail.com <mailto:ribalkin@gmail.com>


Reply to: