Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

>=0.16.0: Cannot compare versions because the number of old versions is different than the number of new versions #359

Open
lalithaawgu opened this issue May 16, 2023 · 4 comments

Comments

@lalithaawgu
Copy link

I am configuring a multimodule maven project to use the maven plugin.
But I see this error when i specify 4 jars in to compare against 4 jars in
If i skip entirely build succeeds but doesnt report missing classes.
This seems to be an issue only with v0.16.0 onwards, doesnt happen in v0.15.7.

Is it possible to compare oldVersion artifact(does NOT pull the classpath dependencies ) against the newVersion classpath dependencies(is pulled in automatically which is good)

Caused by: japicmp.exception.JApiCmpException: Cannot compare versions because the number of old versions is different than the number of new versions.

com.github.siom79.japicmp japicmp-maven-plugin 0.16.0

@siom79
Copy link
Owner

siom79 commented May 16, 2023

Can you post the configuration of the maven plugin? Looks like you are using the option breakBuildBasedOnSemanticVersioningForMajorVersionZero?

@lalithaawgu
Copy link
Author

lalithaawgu commented May 16, 2023

Successful with 0.15.7.

<configuration>
  <newVersions>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>${project.artifactId}</artifactId>
      <version>${project.version}</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>group1</groupId>
      <artifactId>artifact1</artifactId>
      <version>2.3.7</version>
    </dependency>
    <dependency>
      <groupId>group2</groupId>
      <artifactId>artifact2</artifactId>
      <version>0.2.7</version>
    </dependency>
    <dependency>
      <groupId>group3</groupId>
      <artifactId>artifact3</artifactId>
      <version>0.2.7</version>
    </dependency>
  </newVersions>
  <oldVersions>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>${project.artifactId}</artifactId>
      <version>2.4.8.RELEASE</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>group1</groupId>
      <artifactId>artifact1</artifactId>
      <version>2.3.3</version>
    </dependency>
    <dependency>
      <groupId>group2</groupId>
      <artifactId>artifact2</artifactId>
      <version>0.2.6</version>
    </dependency>
    <dependency>
      <groupId>group3</groupId>
      <artifactId>artifact3</artifactId>
      <version>0.2.6
      </version>
    </dependency>
  </oldVersions>
  <parameter>
    <onlyBinaryIncompatible>true</onlyBinaryIncompatible>
    <breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
    <breakBuildBasedOnSemanticVersioning>true</breakBuildBasedOnSemanticVersioning>
    <skipXmlReport>true</skipXmlReport>
    <skipPomModules>true</skipPomModules>
    <ignoreMissingOptionalDependency>false</ignoreMissingOptionalDependency>
    <ignoreNonResolvableArtifacts>false</ignoreNonResolvableArtifacts>
    <ignoreMissingClassesByRegularExpressions>
      <ignoreMissingClassesByRegularExpression>^((?!host1\.host2).)*$</ignoreMissingClassesByRegularExpression>
    </ignoreMissingClassesByRegularExpressions>
    <overrideCompatibilityChangeParameters>
      <overrideCompatibilityChangeParameter>
        <compatibilityChange>CONSTRUCTOR_REMOVED</compatibilityChange>
        <binaryCompatible>true</binaryCompatible>
        <sourceCompatible>false</sourceCompatible>
        <semanticVersionLevel>MINOR</semanticVersionLevel>
      </overrideCompatibilityChangeParameter>
    </overrideCompatibilityChangeParameters>
  </parameter>
</configuration>

Thanks!

@martinaldrin
Copy link

martinaldrin commented Dec 8, 2023

We have same issue, we can not uplift to 0.16.0 or any newer version. we are stuck on 0.15.7. We have a multi module project with 40 modules and we only include the modules that have been modified during the test with the -pl option.

mvn com.github.siom79.japicmp:japicmp-maven-plugin:cmp -Pnbc -pl <moduleName> -Doldversion=<old version>
This is our profile

<profile>
           <id>nbc</id>
           <build>
               <plugins>
                   <plugin>
                       <groupId>com.github.siom79.japicmp</groupId>
                       <artifactId>japicmp-maven-plugin</artifactId>
                       <version>${japicmp.maven.plugin.version}</version>
                       <configuration>
                           <oldVersion>
                               <dependency>
                                   <groupId>${project.groupId}</groupId>
                                   <artifactId>${project.artifactId}</artifactId>
                                   <version>${oldversion}</version>
                                   <type>jar</type>
                               </dependency>
                           </oldVersion>
                           <parameter>
                               <onlyModified>true</onlyModified>
                               <includes>
                                   <include>com......</include>
                                   <include>com.....</include>
                                   <include>com......</include>
                               </includes>
                               <excludes>
                                   <exclude>com......</exclude>
                                   <exclude>com.....</exclude>
                               </excludes>
                               <accessModifier>public</accessModifier>
                               <breakBuildOnModifications>false</breakBuildOnModifications>
                               <breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
                               <breakBuildOnSourceIncompatibleModifications>true</breakBuildOnSourceIncompatibleModifications>
                               <onlyBinaryIncompatible>false</onlyBinaryIncompatible>
                               <includeSynthetic>false</includeSynthetic>
                               <ignoreMissingClasses>false</ignoreMissingClasses>
                               <skipPomModules>true</skipPomModules>
                               <overrideCompatibilityChangeParameters>
                                   <overrideCompatibilityChangeParameter>
                                       <compatibilityChange>METHOD_ADDED_TO_INTERFACE</compatibilityChange>
                                       <binaryCompatible>true</binaryCompatible>
                                       <sourceCompatible>true</sourceCompatible>
                                   </overrideCompatibilityChangeParameter>
                                   <overrideCompatibilityChangeParameter>
                                       <compatibilityChange>METHOD_ADDED_TO_PUBLIC_CLASS</compatibilityChange>
                                       <binaryCompatible>true</binaryCompatible>
                                       <sourceCompatible>true</sourceCompatible>
                                   </overrideCompatibilityChangeParameter>
                                   <overrideCompatibilityChangeParameter>
                                       <compatibilityChange>METHOD_ABSTRACT_ADDED_TO_CLASS</compatibilityChange>
                                       <binaryCompatible>true</binaryCompatible>
                                       <sourceCompatible>true</sourceCompatible>
                                   </overrideCompatibilityChangeParameter>
                               </overrideCompatibilityChangeParameters>
                           </parameter>
                       </configuration>
                       <executions>
                           <execution>
                               <goals>
                                   <goal>cmp</goal>
                               </goals>
                               <phase>verify</phase>
                           </execution>
                       </executions>
                   </plugin>
               </plugins>
           </build>
       </profile>

@siom79
Copy link
Owner

siom79 commented Feb 24, 2024

Have you tried a new version like 0.18.5? In these versions the code throwing the Cannot compare versions because the number of old versions is different than the number of new versions. does no longer exist.

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

No branches or pull requests

3 participants