Welcome! Please see the About page for a little more info on how this works.

0 votes
in tools.deps.alpha by

Support for Maven repository credentials was added in https://dev.clojure.org/jira/browse/TDEPS-9 but only permits a settings.xml in the default location (~/.m2/settings.xml or the one bundled with the Maven install).

Allowing user to specify the path to an alternative Maven settings would help in shared environments (e.g. CI servers where builds should be isolated). This could perhaps be done with a new optional key :mvn/settings. I'd be happy to propose a patch if you're interested.

Alternatively supporting Thomas Spellman's suggestion in TDEPS-9 (allowing user to specify repo credentials in deps.edn) would solve the same problem and has the benefit of not requiring a separate settings file.

7 Answers

0 votes
by

Comment made by: alexmiller

I don't think it makes sense to make bespoke things for this. What does Maven do? Can we respect that?

0 votes
by

Comment made by: cbowdon

Thanks for looking at this. Maven allows passing an alternative path to settings.xml with a command line argument, so perhaps an additional -Smaven-settings option for clj would be appropriate.

0 votes
by

Comment made by: tsachev

I think maven settings builder used by tools.deps also supports custom settings.xml file location with system property {{org.apache.maven.user-settings}}

clj -J-Dorg.apache.maven.user-settings=/my/settings.xml

0 votes
by

Comment made by: cbowdon

Thanks for the suggestion Vladimir. Unfortunately it seems this system property isn't supported with Maven 3: https://issues.apache.org/jira/browse/MNG-5199 . I tested it myself anyway, both with clj and mvn, but had no luck.

0 votes
by

Comment made by: tcrawley

The {{org.apache.maven.user-settings}} sysprop (link: https://github.com/apache/maven/blob/maven-3.5.2/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java#L38 text: is supported) by the maven lib version that tools.deps is using (currently 3.5.2). The reason specifying it does not work is the {{clojure}} script does not pass the {{-J}} options ({{$java_opts}} within the script) to (link: https://github.com/clojure/brew-install/blob/1.9.0/src/main/resources/clojure#L301 text: the java invocation that resolves dependencies). If you modify the script to set that sysprop directly or pass the JVM options, you can see the sysprop working. I'm not advocating that passing all of the JVM opts to the resolution invocation is a solution, just a way to confirm that this sysprop does indeed work.

0 votes
by

Comment made by: alexmiller

Yeah, don't want to pass all JVM options to the classpath generation invocation. Will need to either create a way to do that specifically or pass this as a prop a different way.

0 votes
by
Reference: https://clojure.atlassian.net/browse/TDEPS-99 (reported by alex+import)
...