You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rajesh Deshpande <ra...@gmail.com> on 2019/06/11 16:48:16 UTC

Maven question - how to pull code from bitbucket repository as dependency

Hello,
I have a maven project that builds Java jar files. I wan to run a python
script as one of the goals in the verify phase. I am planning to use the
ant run plugin for running the python script. The python script is stored
in a separate repository that I would like to copy to my project root
folder using maven. Is this possible? What's the best way to approach this?

Thanks!

Re: Maven question - how to pull code from bitbucket repository as dependency

Posted by Jason Young <ja...@procentive.com>.
On Wed, Jun 12, 2019 at 1:04 AM Anders Hammar <an...@hammar.net> wrote:

> Having a dependency to some other scm repo is not a good approach. If that
> changes your build could fail all of a sudden and you want consistency.
>

This is not true. The "big 3" VCSes each allow you to checkout a specific
tag or revision if you like. If both projects (the dependent and the
dependency) use the same VCS, then, at least in the cases of Git and SVN,
you have a VCS-specific feature, e.g. Git subrepos or SVN externals, to
work with the dependency's repo pretty seamlessly (though admittedly their
use is controversial, but let's not go on a tangent about it :) ).


> Your Maven project should typically be self contained. Any dependency
> should be a Maven artifact (that is immutable).
>

It is certainly preferable to make one Maven project depend on another when
possible, but keep in mind there are by necessity other kinds of
dependencies too: The JDK, system-level libraries not provided by some
JVMs, a SQL database, etc. You _can_ mavenize a lot of dependencies (like a
SQL database project) and gain Maven's dependency management, but that is
not invariably worth the cost of implementing and maintaining that
mavenization.

/Anders
>
> On Wed, Jun 12, 2019 at 7:50 AM Rajesh Deshpande <
> rajesh.deshpande@gmail.com>
> wrote:
>
> > Hello,
> > I have a maven project that builds Java jar files. I wan to run a python
> > script as one of the goals in the verify phase. I am planning to use the
> > ant run plugin for running the python script. The python script is stored
> > in a separate repository that I would like to copy to my project root
> > folder using maven. Is this possible? What's the best way to approach
> this?
> >
> > Thanks!
> >
>

Re: Maven question - how to pull code from bitbucket repository as dependency

Posted by Anders Hammar <an...@hammar.net>.
Having a dependency to some other scm repo is not a good approach. If that
changes your build could fail all of a sudden and you want consistency.

Your Maven project should typically be self contained. Any dependency
should be a Maven artifact (that is immutable).

/Anders

On Wed, Jun 12, 2019 at 7:50 AM Rajesh Deshpande <ra...@gmail.com>
wrote:

> Hello,
> I have a maven project that builds Java jar files. I wan to run a python
> script as one of the goals in the verify phase. I am planning to use the
> ant run plugin for running the python script. The python script is stored
> in a separate repository that I would like to copy to my project root
> folder using maven. Is this possible? What's the best way to approach this?
>
> Thanks!
>

Re: Maven question - how to pull code from bitbucket repository as dependency

Posted by Matthieu BROUILLARD <ma...@brouillard.fr>.
If your script is hosted on SVN or git then you can also perhaps do a
simple GET on a well know resources (SHA1 or tag) on the raw file directly.
That way the download is easy and you have a reproducible build because you
target a fixed version of the script.

Matthieu

On Wed, Jun 12, 2019 at 8:11 AM Thorsten Heit <th...@vkb.de> wrote:

> Hi,
>
> > I have a maven project that builds Java jar files. I wan to run a python
> > script as one of the goals in the verify phase. I am planning to use the
> > ant run plugin for running the python script. The python script is
> stored
> > in a separate repository that I would like to copy to my project root
> > folder using maven. Is this possible? What's the best way to approach
> this?
>
> Although I have to admin I never tried it ;-), but two ideas:
>
> 1) Use the JGit Ant task ([1]) to checkout your source code before you
> execute the python script from within the Ant task.
>
> 2) Add a second plugin configuration for maven scm that is being executed
> in the verify phase. Configure the scm plugin and add at least the
> (developer) connection url, and perhaps the destination (checkout)
> directory in which your script is to be stored. See [2].
>
>
>
>
> [1] https://wiki.eclipse.org/JGit/User_Guide#Ant_Tasks
> [2] https://maven.apache.org/scm/maven-scm-plugin/checkout-mojo.html
>
> HTH
>
> Thorsten

Re: Maven question - how to pull code from bitbucket repository as dependency

Posted by Thorsten Heit <th...@vkb.de>.
Hi,
 
> I have a maven project that builds Java jar files. I wan to run a python
> script as one of the goals in the verify phase. I am planning to use the
> ant run plugin for running the python script. The python script is 
stored
> in a separate repository that I would like to copy to my project root
> folder using maven. Is this possible? What's the best way to approach 
this?

Although I have to admin I never tried it ;-), but two ideas:

1) Use the JGit Ant task ([1]) to checkout your source code before you 
execute the python script from within the Ant task.

2) Add a second plugin configuration for maven scm that is being executed 
in the verify phase. Configure the scm plugin and add at least the 
(developer) connection url, and perhaps the destination (checkout) 
directory in which your script is to be stored. See [2].




[1] https://wiki.eclipse.org/JGit/User_Guide#Ant_Tasks
[2] https://maven.apache.org/scm/maven-scm-plugin/checkout-mojo.html

HTH

Thorsten