Maven 1.x Ant Plugin

Ant build.xml looking for dependenciesin several remote repositories

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.1
  • Fix Version/s: 1.9
  • Component/s: None
  • Labels:
    None
  • Environment:
    Any
  • Number of attachments :
    0

Description

The generated ant build.xml only tries to download dependent jars from one remote repository.

It should also try to download from the alternate remote repositories in maven.repo.remote.

Activity

Hide
Arnaud Heritier added a comment -

Not really easy to do.
Because of MPANT-20, we define a unique property for each dependency. Using several repositories will break it because we'll need to download several times the same dependency. We'll not be able to do it with a property (which is immutable).

What we can do easily is to provide a property which will allow the user to select the repository to use (and not the default ${maven.repo.remote}[0]). Can it help you ?

Show
Arnaud Heritier added a comment - Not really easy to do. Because of MPANT-20, we define a unique property for each dependency. Using several repositories will break it because we'll need to download several times the same dependency. We'll not be able to do it with a property (which is immutable). What we can do easily is to provide a property which will allow the user to select the repository to use (and not the default ${maven.repo.remote}[0]). Can it help you ?
Hide
Oscar Picasso added a comment -

> Can it help you ?

Not really because I use mostly ibiblio.

The other repository is just for jars that are not in ibiblio. A single project can depend on jars that are on both repositories.

Anyway I just use the ant build.xml to not disturb developers that don't still know maven. In the end I would prefer to work in an only maven environment.

So don't worry I can live with what we have now.

Thanks for trying.

Show
Oscar Picasso added a comment - > Can it help you ? Not really because I use mostly ibiblio. The other repository is just for jars that are not in ibiblio. A single project can depend on jars that are on both repositories. Anyway I just use the ant build.xml to not disturb developers that don't still know maven. In the end I would prefer to work in an only maven environment. So don't worry I can live with what we have now. Thanks for trying.
Hide
Arnaud Heritier added a comment -

I understand your problem.
Can't you create a private repository in your company with all jars that you need.
You can use maven proxy : http://maven-proxy.codehaus.org/

Show
Arnaud Heritier added a comment - I understand your problem. Can't you create a private repository in your company with all jars that you need. You can use maven proxy : http://maven-proxy.codehaus.org/
Hide
Oscar Picasso added a comment -

Proxying would be the way to go in most cases.

However it won't work in my case. I am working on an open source project.

The 'specific' remote repository is simply hosted on sourceforge.

I don't have the luxury, at the moment, to setup a publicly available java application server for the proxy.

Show
Oscar Picasso added a comment - Proxying would be the way to go in most cases. However it won't work in my case. I am working on an open source project. The 'specific' remote repository is simply hosted on sourceforge. I don't have the luxury, at the moment, to setup a publicly available java application server for the proxy.
Hide
Arnaud Heritier added a comment -

ok. I think I found a way to do it.
I'll warn you when it will be done.

Show
Arnaud Heritier added a comment - ok. I think I found a way to do it. I'll warn you when it will be done.
Hide
Arnaud Heritier added a comment -

Fixed.

Show
Arnaud Heritier added a comment - Fixed.
Hide
Oscar Picasso added a comment -

I tested your fix.

It works and can retrieves the jars from several repositories.

Some few comments below.

1- The generated build.xml script has the following lines:
<property name="proxy.host" value="${maven.proxy.host}">
</property>

In case you don't have set ${maven.proxy.host}, proxy.host is set to the string "${maven.proxy.host}" so the script is in "useProxy mode".

On execution of the script, ant complains with the following:

BUILD FAILED
<path-to-project>/build.xml:313: java.lang.NumberFormatException: For input string: "${maven.proxy.port}"

In order to succeed you have to explicitly set ${maven.proxy.port} to an empty string. Something like:

$ ant -Dmaven.proxy.host=

which is not something you should have to do.

My first impression is that the two lines that set proxy.host shouldn't be generated when maven.proxy.host is not set in maven.

2- Once the problem above corrected, the ant script execution produce several error messages like:

[get] Error opening connection java.io.FileNotFoundException...

It doesn't affect the final results. It doesn't mean that something really went wrong, just that some jars are not in some repositories which is expected.

Removing these pesky messages would be "la cerise sur le gāteau".

I'm not sure, though, if:

  • it's easy.
  • it's doable without removing the messages that need to remain (for example if all connection for a give jar failed).

In any case I really appreciate what you have done.

Oscar

Show
Oscar Picasso added a comment - I tested your fix. It works and can retrieves the jars from several repositories. Some few comments below. 1- The generated build.xml script has the following lines: <property name="proxy.host" value="${maven.proxy.host}"> </property> In case you don't have set ${maven.proxy.host}, proxy.host is set to the string "${maven.proxy.host}" so the script is in "useProxy mode". On execution of the script, ant complains with the following: BUILD FAILED <path-to-project>/build.xml:313: java.lang.NumberFormatException: For input string: "${maven.proxy.port}" In order to succeed you have to explicitly set ${maven.proxy.port} to an empty string. Something like: $ ant -Dmaven.proxy.host= which is not something you should have to do. My first impression is that the two lines that set proxy.host shouldn't be generated when maven.proxy.host is not set in maven. 2- Once the problem above corrected, the ant script execution produce several error messages like: [get] Error opening connection java.io.FileNotFoundException... It doesn't affect the final results. It doesn't mean that something really went wrong, just that some jars are not in some repositories which is expected. Removing these pesky messages would be "la cerise sur le gāteau". I'm not sure, though, if:
  • it's easy.
  • it's doable without removing the messages that need to remain (for example if all connection for a give jar failed).
In any case I really appreciate what you have done. Oscar
Hide
Arnaud Heritier added a comment -
  • Proxy settings :
    I found the problem. Personally my property "maven.proxy.host" is setted to an empty string in my ~/build.properties. It's why I didn't see this error. The problem is that ant doesn't replace unknow properties with an empty string or null (what Jelly does). I removed the default initialization for these properties (it's more annoying than useful).
  • Get dependencies
    Sorry but I can't give you "la cerise sur le gateau"
    These messages are provided by the get task in ant and I can't configure them.

I just publish a new snapshot and updated the staging site.

Show
Arnaud Heritier added a comment -
  • Proxy settings : I found the problem. Personally my property "maven.proxy.host" is setted to an empty string in my ~/build.properties. It's why I didn't see this error. The problem is that ant doesn't replace unknow properties with an empty string or null (what Jelly does). I removed the default initialization for these properties (it's more annoying than useful).
  • Get dependencies Sorry but I can't give you "la cerise sur le gateau" These messages are provided by the get task in ant and I can't configure them.
I just publish a new snapshot and updated the staging site.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: