views:

1397

answers:

2

In my base project I use dependency of JasperReports which has non-existent repository declaration in its pom. When I run every Maven commad there is dependency looking for commons-collection in this Jasper repository so I need to wait for timeout.
This is my base project and is used as dependency in my others projects so again I need to wait for timeout.
Is there are a way to move this repository to blacklisted or override this settings?

Notes:
1.Why it search in Jasper repository, maybe bacause of ranges

<dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
    <version>[2.1,)</version>
    <scope>compile</scope>
</dependency>

2.My idea to resolve this problem is to change jasper pom and use proxy repository, but I looking to another option.
3.I use jasperreports 1.3.3 version and I'd like don't change it.

+1  A: 

Is there a way to move this repository to blacklisted or override this settings?

To my knowledge, this is not possible.

Why does it search in Jasper repository, maybe because of ranges

Yes, I think ranges are "responsible" here of this behavior. Without ranges, Maven wouldn't have to check remote repositories for a newer version than the one available in your local repo.

My idea to resolve this problem is to change jasper pom and use proxy repository, but I looking to another option.

Fixing jasper pom and using a proxy repository would of course be the ideal solution but this is not always possible. There is maybe a workaround though. Did you try to exclude jasperreports's transitive dependencies that have ranges and to provide them yourself (with fixed version) in your pom instead. Something like this:

<dependencies>
  <dependency>
    <groupId>jasperreports</groupId>
    <artifactId>jasperreports</artifactId>
    <version>1.3.3</version>
    <!-- Remove Transitive dependencies drawn by Jasper Report that we don't want -->
    <exclusions>
      <exclusion>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
      </exclusion>
      ...
    </exclusions>
  </dependency>
  <dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
    <version>2.1</version><!-- Or whatever version, as long as it's fixed -->
    <scope>compile</scope>
  </dependency>
  ....
<dependencies>

This way, Maven shouldn't have to check the non existent repository and this should avoid having to wait for the timeout. I'd give it a try.

I use jasperreports 1.3.3 version and I'd like don't change it.

No problem.

Pascal Thivent
@Pascal. Thanks it helps. Ranges in Maven are evil :)
cetnar
@cetnar Glad it was useful. And I agree, ranges are not good, they add more problems than solutions.
Pascal Thivent
A: 

You can override a repo by using a mirrorOf declaration in your settings.xml. Although that not what it's typically intended for, setting for example a mirrorOf on the jasper reports repoid and point it at Central (repo1.maven.org) would effectively make it disappear.

A better option is to use a repository manager like Nexus and then you can control what proxies and artifacts are actually served.

Brian Fox