Giter Site home page Giter Site logo

Comments (8)

siom79 avatar siom79 commented on May 19, 2024

Hi rouzwawi,

I have tried to reconstruct your issue. The pom.xml of my base project looks like this one:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>japicmp-test</groupId>
    <artifactId>japicmp-test-base</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>japicmp-test-commons</module>
    </modules>
    <dependencies>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>18.0</version>
        </dependency>
    </dependencies>
</project>

The child module japicmp-test-commons has the following pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>japicmp-test-base</artifactId>
        <groupId>japicmp-test</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>japicmp-test-commons</artifactId>

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.siom79.japicmp</groupId>
                <artifactId>japicmp-maven-plugin</artifactId>
                <version>0.5.1</version>
                <configuration>
                    <oldVersion>
                        <file>
                            <path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
                        </file>
                    </oldVersion>
                    <newVersion>
                        <file>
                            <path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
                        </file>
                    </newVersion>
                </configuration>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>cmp</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Now the japicmp plugin outputs:

[INFO] --- japicmp-maven-plugin:0.5.1:cmp (default) @ japicmp-test-commons ---
[INFO] /opt/maven/repository/guava-18.0.jar; scope: compile
...

Note that the second [INFO] line denotes that the guava library from the parent pom has been added to the classpath. Hence I was not able to reproduce the issue.

Can you check with mvn help:effective-pom within the child module's directory that the guava dependency you are missing is shown in the dependencies section?

from japicmp.

rouzwawi avatar rouzwawi commented on May 19, 2024

I've tried to isolate the problem a bit more now and I have an example that triggers it here: https://github.com/rouzwawi/japicmp-test

The setup is two modules a and b where a depends on guava and exposes a type SpecialFuture extends AbstractFuture. b in turn depends on a and exposes SpecialFuture in it's public api.

I get:

[ERROR] Failed to execute goal com.github.siom79.japicmp:japicmp-maven-plugin:0.5.1:cmp (default) on project test-leaf: Execution default of goal com.github.siom79.japicmp:japicmp-maven-plugin:0.5.1:cmp failed: Could not load 'com.example.Using$MyFuture': com.google.common.util.concurrent.AbstractFuture. Please make sure that all libraries have been added to the classpath (CLASSPATH=/usr/local/Cellar/maven/3.3.3/libexec/boot/plexus-classworlds-2.5.2.jar:/Users/rouz/code/japicmp-transitive/a/target/test-common-1.0.0-SNAPSHOT.jar) or try the option '--ignore-missing-classes'. -> [Help 1]

While trying to provoke the error I noticed that it only happens when my jar somehow exposes a type from the transitive dependency. In this case, MyFuture extends SpecialFuture which extends AbstractFuture from guava.

The same thing happens if I have this in my public api

// exposed somehwere in test-leaf
public SpecialFuture foo() {
    return new SpecialFuture() {};
}

from japicmp.

siom79 avatar siom79 commented on May 19, 2024

Thank you for setting up such a detailed project that triggers the problem. With its help I could track down the issue in the japicmp maven plugin. The solution is rather simple (see here).

I have committed the fix on the develop branch. With your project setup this worked.

If you want you can try it yourself:

git clone https://github.com/siom79/japicmp.git
cd japicmp
git checkout develop
mvn clean install

Then update the version of the japicmp maven plugin in your sample project to 0.5.2-SNAPSHOT and rebuild it.

from japicmp.

rouzwawi avatar rouzwawi commented on May 19, 2024

Neat fix! And i just tried the develop branch on my real project and it all works fine!

Thanks!

from japicmp.

adrienlauer avatar adrienlauer commented on May 19, 2024

I recently tried the japicmp maven plugin in my project and this fix is a must have for me. It's working perfectly with the develop branch version.

from japicmp.

rouzwawi avatar rouzwawi commented on May 19, 2024

@siom79 do you have an ETA on 0.5.2?

from japicmp.

siom79 avatar siom79 commented on May 19, 2024

As soon as I have feedback for issue #66, I will release these two issues.

from japicmp.

siom79 avatar siom79 commented on May 19, 2024

Released with version 0.5.2.

from japicmp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.