bazelbuild / migration-tooling

Migration tools for Bazel
Apache License 2.0
45 stars 30 forks source link

Add support for artifactory and private repositories #14

Open petroseskinder opened 7 years ago

petroseskinder commented 7 years ago

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!

epollan commented 6 years ago

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.

petroseskinder commented 6 years ago

Yes, in fact, it would.

epollan commented 6 years ago

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

petroseskinder commented 6 years ago

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.

wstrange commented 6 years ago

@petroseskinder Any updates on this?

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

mweiden commented 6 years ago

@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 commented 6 years ago

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

petroseskinder commented 6 years ago

@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.