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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Rajesh Deshpande
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!
Reply | Threaded
Open this post in threaded view
|

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

Anders Hammar
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 <[hidden email]>
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!
>
Reply | Threaded
Open this post in threaded view
|

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

Thorsten Heit-3
In reply to this post by Rajesh Deshpande
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
Reply | Threaded
Open this post in threaded view
|

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

Matthieu BROUILLARD-3
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 <[hidden email]> 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