4

I have below plugin in my pom:

<plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>jasperreports-maven-plugin</artifactId>
                    <version>1.0-beta-2</version>
                    <dependencies>                       
                        <dependency>
                            <!-- The dependency specified by the plugin doesn't work so we must provide our own -->
                            <groupId>net.sf.jasperreports</groupId>
                            <artifactId>jasperreports</artifactId>
                            <version>${jasperreports.version}</version>
                            <exclusions>
                                <exclusion>
                                    <groupId>jfree</groupId>
                                    <artifactId>jcommon</artifactId>
                                </exclusion>
                                <exclusion>
                                    <groupId>com.lowagie</groupId>
                                    <artifactId>itext</artifactId>
                                </exclusion>
                            </exclusions>
                        </dependency>
                        <!-- Groovy compiler seems to be required but not part of JasperReports' specified dependencies-->
                        <dependency>
                            <groupId>org.codehaus.groovy</groupId>
                            <artifactId>groovy-all</artifactId>
                            <version>${groovy.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.lowagie</groupId>
                            <artifactId>itext</artifactId>
                            <version>${itext.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>

The 1.0-beta-2 version of the above plugin points to jasperreports artifact of version 1.2.0, which in turn points to an open-ended commons-collections of [2.1, ) In 1.0-beta-2 pom:

<dependency>
      <groupId>jasperreports</groupId>
      <artifactId>jasperreports</artifactId>
      <version>1.2.0</version>
    </dependency>

And in jasperreports 1.2.0 pom:

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

In my case, there has been an push by someone else to a nexus repostiory, an artifact called 3.2.1-redhat-7 commons-collections. jasperreports-maven-plugin is pointing to the above collections version which happens to be a corrupt one. There is a valid 3.2.1 version of commons collection. I need to exclude the jasperreports artifact and force the jasperreports-maven-plugin to use net.sf.jasperreports. I have alread tried adding

<dependency>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>jasperreports-maven-plugin</artifactId>
                            <version>1.0-beta-2</version>
                            <exclusions>
                                <exclusion>
                                    <groupId>jasperreports</groupId>
                                    <artifactId>jasperreports</artifactId>
                                </exclusion>
                            </exclusions>
                        </dependency>

to the above plugin, but it still points to the same 1.2.0 jasperreports that points to an open-ended commons-collections, and the build fails. However if i comment out the dependency "jasperreports" in the jasperreports-maven-plugin.pom, it uses the jasperreports from net.sf.jasperreports and builds fine. Please let me know.

user1455116
  • 2,034
  • 4
  • 24
  • 48

2 Answers2

1

Sorry for not really answering (can't comment yet due to lack of reputation), but:
1.
in case you are in a hurry the way i was, here is a workaround, from http://community.jaspersoft.com/questions/967926/issue-maven-plugin-codehaus-dec-9-2015:

You need to add

https://maven.repository.redhat.com/nexus/content/groups/product-ga

as one of your remote repos.

thanks a lot to joel.witham

2.
I think that this answer to Maven dependency management for plugin dependencies

is most promising..i.e. don't exclude jasper-1.2 but make sure it's using the correct dependency version.

Community
  • 1
  • 1
tobi42
  • 805
  • 10
  • 18
  • Adding porduct-ga as another mirror in my settings.xml solved the problem for now. Thank you. – user1455116 Dec 10 '15 at 17:14
  • There were other problems when i tried to explicitly use jasperreports artifact of 1.2, exclude open ended commons-collections and force it use a specific commons-collections version. So, i have to rely on the remote repo as a temporary fix. – user1455116 Dec 10 '15 at 17:26
  • i explicitly added commons-collections-3.2.1 as another depdendecy to the jasperreports-maven-plugin..worked..i removed the product-ga repo..still worked..then i removed the explicit depdency once again..still worked?!?. Maybe meanwhile someone fixed the problem in the public repos..i could research what version of commons-collections jasperreports-maven is now using when i comment out the explicit commons-collection dep, but i feel like i spend enough time on this ;-). I can settle with having run mvn -X install and having seen that it uses 3.2.1 then i explicitly set it.. – tobi42 Dec 10 '15 at 21:28
1

Try this configuration :

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jasperreports-maven-plugin</artifactId>
    <version>1.0-beta-2</version>
    ...
    <dependencies>
        ...
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.1</version>
        </dependency>
         <dependency>
            <groupId>jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>1.2.0</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-collections</groupId>
                    <artifactId>commons-collections</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
</plugin>
Basemasta
  • 381
  • 1
  • 13