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

Old version is not ignored when <oldVersion> doesn't exist #153

Closed
cristalp opened this issue Nov 17, 2016 · 3 comments
Closed

Old version is not ignored when <oldVersion> doesn't exist #153

cristalp opened this issue Nov 17, 2016 · 3 comments

Comments

@cristalp
Copy link

This is my configuration:

  <plugin>
    <groupId>com.github.siom79.japicmp</groupId>
    <artifactId>japicmp-maven-plugin</artifactId>
    <version>0.9.2</version>
    <configuration>
      <skip>${skip.api-compatibility.check}</skip>
      <newVersion>
        <file>
          <path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
        </file>
      </newVersion>
      <parameter>
        <onlyModified>true</onlyModified>
        <breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
        <breakBuildBasedOnSemanticVersioning>true</breakBuildBasedOnSemanticVersioning>
        <onlyBinaryIncompatible>true</onlyBinaryIncompatible>
        <ignoreMissingClasses>true</ignoreMissingClasses>
        <skipPomModules>true</skipPomModules>
        <noAnnotations>false</noAnnotations>
        <ignoreNonResolvableArtifacts>false</ignoreNonResolvableArtifacts>
        <ignoreMissingOldVersion>true</ignoreMissingOldVersion>
        <ignoreMissingNewVersion>true</ignoreMissingNewVersion>
        <packagingSupporteds>
          <packagingSupported>jar</packagingSupported>
          <packagingSupported>ejb</packagingSupported>
        </packagingSupporteds>
        <reportOnlyFilename>false</reportOnlyFilename>
        <skipXmlReport>true</skipXmlReport>
        <skipHtmlReport>true</skipHtmlReport>
        <skipDiffReport>true</skipDiffReport>
      </parameter>
    </configuration>
    <executions>
      <execution>
        <id>check-api-compatibility-for-semantic-versioning</id>
        <phase>package</phase>
        <goals>
          <goal>cmp</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

We have some Maven modules that we've started writing. There is no released version, and we're on version 1.0.0-SNAPSHOT.

The way I understand it is that the plugin looks in the Maven repo for the latest released version if I don't specify an . And then I would expect ignoreMissingOldVersion=true to completely skip that and to ignore everything when there's no old version.

However, I get the following error:
[INFO] --- japicmp-maven-plugin:0.9.2:cmp (check-api-compatibility-for-semantic-versioning) @ foo-api ---
[INFO] artifact com.example:foo-api: checking for updates from repository.central
[INFO] Unable to find a previous version of the project in the repository.
[WARNING] Please provide at least one resolvable old version using one of the configuration elements or .
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.431 s
[INFO] Finished at: 2016-11-17T15:19:27+01:00
[INFO] Final Memory: 66M/894M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.siom79.japicmp:japicmp-maven-plugin:0.9.2:cmp (check-api-compatibility-for-semantic-versioning) on project foo-api: Please provide at least one old version. -> [Help 1]

If I understand the configuration correctly, this looks like a bug to me...
The only option I have at the moment is to skip the plugin (thanks for that possibility!).

@siom79
Copy link
Owner

siom79 commented Nov 17, 2016

You are using the option <breakBuildBasedOnSemanticVersioning/>. This means that

If set to true, the plugin analyzes the versions of the old and new archives and decides based on these versions if binary compatible or incompatible changes are allowed or not.

As there is no old version, it is impossible to decide whether it should break the build or not. Maybe we did not find the artifact on the repository you have configured but it is located somewhere else.

But it looks like users expect that the plugin does not fail if additionally the option <ignoreMissingOldVersion/> is set to true.

siom79 added a commit that referenced this issue Nov 17, 2016
…nd ignoreMissingOldVersion=true and old version missing
siom79 added a commit that referenced this issue Nov 17, 2016
…nd old version missing but new version has binary compatible changes
@cristalp
Copy link
Author

Yes, exactly :-)
Thanks for adding this.

@siom79
Copy link
Owner

siom79 commented Nov 19, 2016

Will be published with next release.

@siom79 siom79 closed this as completed Nov 19, 2016
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

2 participants