Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Version Conflict #27

Open
johaq opened this issue Mar 2, 2017 · 12 comments
Open

Version Conflict #27

johaq opened this issue Mar 2, 2017 · 12 comments

Comments

@johaq
Copy link

johaq commented Mar 2, 2017

Some old messages depend on an older version of message_generation.
Example:

org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), org.ros.rosjava_messages:people_msgs:jar:1.0.4 -> 
org.ros.rosjava_bootstrap:message_generation:jar:[0.1,0.2), org.ros.rosjava_core:rosjava:jar:0.2.1 -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), org.ros.rosjava_core:rosjava:jar:0.2.1 -> 

Makes it impossible to include newest version of some messages with maven.

@adamantivm
Copy link
Contributor

@johaq thanks for the report. I am sure you are right, but I can't fully understand your report based on the formatting you presented. Could you please share one example of a Gradle dependencies section you're trying to set-up that fails?

@johaq
Copy link
Author

johaq commented Mar 2, 2017

Using maven not gradle.
Maven dependencies extract:

<dependency>
       <groupId>org.ros.rosjava_messages</groupId>
       <artifactId>std_msgs</artifactId>
       <version>0.5.10</version>
</dependency>
<dependency>
       <groupId>org.ros.rosjava_messages</groupId>
       <artifactId>people_msgs</artifactId>
       <version>1.0.4</version>
</dependency>

@adamantivm
Copy link
Contributor

I understand it now, thanks. This unfortunately doesn't have an easy solution. Suggestions are welcome, meanwhile this is noted as an important thing to fix and support properly.

@johaq
Copy link
Author

johaq commented Mar 2, 2017

Should be a simple fix extending the version range in the people_msgs pom, no?

In
rosjava_mvn_repo/org/ros/rosjava_messages/people_msgs/1.0.4/people_msgs-1.0.4.pom
change version range

<dependency>
      <groupId>org.ros.rosjava_bootstrap</groupId>
      <artifactId>message_generation</artifactId>
      <version>[0.1,0.2)</version>
      <scope>runtime</scope>
</dependency>

@adamantivm
Copy link
Contributor

That may solve it for this case in particular, but not for others who run into the same issue. Besides, the reason that range has that value is because this particular version of people_msgs was built with rosjava message generation as it was in version 0.1.x so changing the dependency range manually introduces the risk that you will be running with wrong classes (a version it wasn't built with).
The proper proper thing to do would be to re-generate people_msgs with a recent version of rosjava, but then since the version of people_msgs hasn't changed, the older artifact will be overridden by the new one and then you will have the opposite problem (i.e.: this won't work with projects that are trying to build against indigo / 0.2.x for example).
Maybe one solution could be to keep a separate maven repo per release with the appropriate range for each, but that would require also revamping build tools so that they know which particular repo to use in each case. Or there may be other solutions, I don't know.
In any case, I would rather do this experimentally on a separate fork so as not to affect everyone with test patches, and that will take me some time to get around to.

I am interested in finding workarounds in the meantime. For example, in Gradle it is possible to specify that you want to exclude some dependencies when you request a package. In this case, things may work if you specify to exclude 'message_generation' from the 'people_msgs' dependency declaration. Is there any way to do that with maven directly as well? I would assume yes.

@LeroyR
Copy link

LeroyR commented Mar 3, 2017

Newest version of people_msgs is 1.0.10 but 1.0.4 is latest here.
http://repositories.ros.org/status_page/ros_kinetic_default.html?q=people

re-generate should fix the issues in this case.

For maven there is: exclude-dependencies

@adamantivm
Copy link
Contributor

I don't know how I missed that. I actually went to the people_msgs repo to check and somehow thought there wasn't any newer version.
I will see about releasing the newer version with kinetic message_generation and that should address this one problem, I agree.
Nonetheless, the base overall problem stands, with the exclude-dependencies hack as a workaround.

@adamantivm
Copy link
Contributor

ok, I updated people_maps to 1.0.10 with the new dependency range. @johaq could you please try to see if that fixes your issue in particular?

@jubeira
Copy link

jubeira commented May 10, 2017

@johaq I believe #36 should solve the dependency problem when using maven.
I think this issue can be closed.

@gbivins
Copy link

gbivins commented Aug 25, 2017

Hi all. It's not clear how to resolve this issue. I'm following the instructions as described here:
No Ros.
My project previously built but it's now broken. The pom for my project looks like this (relevant parts shown here only):

<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>org.doulos</groupId>
    <artifactId>test-rosjava</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>nbm</packaging>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>nbm-maven-plugin</artifactId>
                <version>4.1</version>
                <extensions>true</extensions>
                <configuration>
                    <useOSGiDependencies>true</useOSGiDependencies>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>netbeans</id>
            <name>Repository hosting NetBeans modules</name>
            
            <url>http://bits.netbeans.org/nexus/content/groups/netbeans/</url>
            <!--<url>http://bits.netbeans.org/nexus/content/groups/netbeans</url>-->
            
        </repository>
        <repository>
            <id>ros</id> 
            <name>ros</name>
            <url>https://github.com/rosjava/rosjava_mvn_repo/raw/master</url>
        </repository>
    </repositories>
<dependencies>
<dependency>
            <groupId>org.ros.rosjava_core</groupId>
            <artifactId>rosjava</artifactId>
            <version>0.2.2</version>
            <type>jar</type>
            
        </dependency>
</dependencies>

From the dependencies resolution output, it looks like this:

Failed to execute goal on project test-rosjava: Could not resolve dependencies for project org.doulos:test-rosjava:nbm:1.0-SNAPSHOT: Failed to collect dependencies for org.doulos:test-rosjava:jar:1.0-SNAPSHOT: Could not resolve version conflict among [org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:rosjava_test_msgs:jar:[0.2,0.3) -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:rosjava_test_msgs:jar:[0.2,0.3) -> org.ros.rosjava_messages:std_msgs:jar:0.5.10 -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:rosgraph_msgs:jar:[1.11,1.12) -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:geometry_msgs:jar:[1.11,1.12) -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:nav_msgs:jar:[1.11,1.12) -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:nav_msgs:jar:[1.11,1.12) -> org.ros.rosjava_messages:actionlib_msgs:jar:1.11.9 -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:tf2_msgs:jar:[0.5,0.6) -> org.ros.rosjava_bootstrap:message_generation:jar:[0.3,0.4)] -> [Help 1]

Does anyone building a maven project have a working example of the setup that is required to use rosjava? It seems like there's more to it than how traditional maven projects are setup. Or maybe I'm using the wrong repo to resolve the dependencies?

@jubeira
Copy link

jubeira commented Aug 25, 2017

@gbivins if you split the error in lines you can see what's happening:

Could not resolve version conflict among 
[org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), 
org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:rosjava_test_msgs:jar:[0.2,0.3) -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), 
org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:rosjava_test_msgs:jar:[0.2,0.3) -> org.ros.rosjava_messages:std_msgs:jar:0.5.10 -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3),
 org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:rosgraph_msgs:jar:[1.11,1.12) -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), 
org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:geometry_msgs:jar:[1.11,1.12) -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), 
org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:nav_msgs:jar:[1.11,1.12) -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3), 
org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:nav_msgs:jar:[1.11,1.12) -> org.ros.rosjava_messages:actionlib_msgs:jar:1.11.9 -> org.ros.rosjava_bootstrap:message_generation:jar:[0.2,0.3),
 org.ros.rosjava_core:rosjava:jar:0.2.2 -> org.ros.rosjava_messages:tf2_msgs:jar:[0.5,0.6) -> org.ros.rosjava_bootstrap:message_generation:jar:[0.3,0.4)] -> [Help 1]

Take a look: rosjava:0.2.2 has dependencies that depend on message_generation:[0.2,0.3) as you would expect.
The problems is that the last dependency on tf2_msgs depend on message_generation:[0.3,0.4), and maven builds don't like this apparently -this doesn't happen with Gradle-.

Try upgrading rosjava to kinetic (that is rosjava:[0.3, 0.4)); the API shouldn't have changed significantly, and many bug fixes were targeted to Kinetic. This issue was solved for Kinetic builds, as all messages have been rebuilt with the new dependency. I think the problem behind is that tf2_msgs didn't change version number since Indigo.

Edit: a hacky workaround is to go to the POM file of your tf2_msgs and edit the dependency to message_generation:[0.2, 0.3). That shouldn't cause you problems, but it's a bit dirty.

@gbivins
Copy link

gbivins commented Aug 25, 2017

Hey @jubeira . This compiles now but after the following changes:

  1. change version of rosjava to [0.3,0.4)
  2. add springboot repo to my pom
  3. add bootstrap_message as a dependency

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants