migration-tooling icon indicating copy to clipboard operation
migration-tooling copied to clipboard

Add support for artifactory and private repositories

Open petroseskinder opened this issue 7 years ago • 8 comments

Migrating from issue 498 in main repository.

This is already implemented on the Bazel side, so similar code can probably be used for generate_workspace. It should use all of the local (settings.xml) configuration options.

An example from the original post:

I think I've run into a similar requirement; I'm trying to use robolectric as in:

bazel run //src/tools/generate_workspace -- --artifact=org.robolectric:robolectric:3.1.2

However, robolectric depends on maven-ant-tasks which depends on some org.codehaus.plexus artifacts. Codehaus.org no longer appears to host code, but bazel is attempting to use it to retrieve the plexus assets:

ERROR: Unable to resolve Maven model from http://snapshots.maven.codehaus.org/maven2/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.pom: 1 problem was encountered while building the effective model
[FATAL] Non-parseable POM http://snapshots.maven.codehaus.org/maven2/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.pom: Expected root element 'project' but found 'html' (position: START_TAG seen \n... @2:7) @ line 2, column 7

I think that if I could specify a settings.xml, then I might be able to resolve this with http://www.codehaus.org/mechanics/maven/

or:

http://stackoverflow.com/questions/30288097/how-to-resolve-codehaus-service-unavailable-maven-build-error

But since this issue seems to state that there is no way to specify a settings.xml when using generate_workspace, does anyone know of some workaround I can use in the meantime?

Thanks!

petroseskinder avatar Jun 13 '17 13:06 petroseskinder

I'm blocked by this too, I believe. Seems like configuring Aether to read settings.xml would do the trick, no? From https://wiki.eclipse.org/Aether/Creating_a_Repository_System_Session:

If you seek a closer cooperation with Apache Maven and want to read configuration from the user's settings.xml, you should have a look at the library org.apache.maven:maven-settings-builder which provides the necessary bits. The method AntRepoSys.getSettings() from the Aether Ant Tasks can serve as inspiration for your own code. But please direct any questions regarding usage of that library to the Maven mailing list.

epollan avatar Sep 26 '17 16:09 epollan

Yes, in fact, it would.

petroseskinder avatar Sep 26 '17 17:09 petroseskinder

OK. I'll try to put together a PR.

epollan avatar Sep 26 '17 17:09 epollan

Thank you. However, if you are willing to wait, I will get one out mid-late next week. This is something that has been on the road map for this project.

petroseskinder avatar Sep 26 '17 17:09 petroseskinder

@petroseskinder Any updates on this?

We can't use bazel until we can integrate with Artifactory.

wstrange avatar Oct 23 '17 19:10 wstrange

@wstrange I have a very unpolished--but working--version of this here... https://github.com/mweiden/migration-tooling/commits/custom-repos I'd need some code review to get this in the proper state.

mweiden avatar Oct 24 '17 09:10 mweiden

@wstrange @petroseskinder @epollan please see https://github.com/bazelbuild/migration-tooling/pull/71

mweiden avatar Oct 24 '17 15:10 mweiden

@petroseskinder Any updates on this?

@wstrange thank you. Due to start of the semester, I have temporarily limited my role on the project. That said, I can help polish your version.

petroseskinder avatar Oct 24 '17 16:10 petroseskinder