grails / grails3-plugins

Grails 3 plugin portal
https://grails.org/plugins.html
Apache License 2.0
3 stars 6 forks source link

Dependency groupId is incorrect for latest version #6

Open dpcasady opened 8 years ago

dpcasady commented 8 years ago

The displayed dependencies block for a given plugin may be incorrect in the case that the plugin has had multiple groupId/artifactId combinations (system_ids) in bintray. Take the excel-export plugin. This plugin is currently at version 2.0.2 and had a previous groupId in bintray of pl.touk while the current version is org.grails.plugins.

When building the plugin page, it looks like plugin metadata is read from bintray and used to build out the plugin details on the page. Continuing our example, that metadata is read from https://api.bintray.com/packages/grails/plugins/excel-export and looks like so:

{
  "name": "excel-export",
  "repo": "plugins",
  "owner": "grails-excel-export",
  "desc": "This plugin helps you export data in Excel (xlsx) format, using Apache POI.",
  "labels": [],
  "attribute_names": [],
  "licenses": ["Apache-2.0"],
  "custom_licenses": [],
  "followers_count": 0,
  "created": "2016-11-28T18:56:02.983Z",
  "website_url": "https://github.com/TouK/excel-export",
  "issue_tracker_url": "https://github.com/TouK/excel-export/issues",
  "linked_to_repos": [],
  "permissions": [],
  "versions": ["2.0.2", "2.0.1"],
  "latest_version": "2.0.2",
  "updated": "2016-11-28T22:39:46.878Z",
  "rating_count": 0,
  "system_ids": ["org.grails.plugins:excel-export", "pl.touk:excel-export"],
  "vcs_url": "https://github.com/TouK/excel-export",
  "maturity": ""
}

From that data, the Plugins.es6 file builds the dependencies block from the latest_version, and the last value in the system_ids array. Herein lies the problem if the latest version does not correspond to that last system_id in the array. The result is:

dependencies {
    compile 'pl.touk:excel-export:2.0.2'
}

when it should be:

dependencies {
    compile 'org.grails.plugins:excel-export:2.0.2'
}

I'm not sure the best solution to fix this otherwise I would have made a pull request.

sheehan commented 8 years ago

Thanks for the info. It seems like in general the last value in the system_ids array corresponds to the latest_version. I'm not sure why this one's different but I'll look into it when I get a sec.