maven - What is the best way to read in gradle repository credentials from a properties file? -
it's not clear me logging repository happens in gradle execution/configuration chain
i have task
loadmyproperties { properties props = new properties() props.load(new fileinputstream(mypropertiesfilename)) myusername = props.getproperty('user') mypassword = props.getproperty('password') }
and make compile depend on
compilejava.dependson loadproperties
however, not @ sure when repositories block
repositories { maven { credentials { username myusername password mypassword } url myurl } }
is 'executed' compared other tasks, nor when attempts gain authorization specified repository provided credentials. when run
gradle build
sometimes credentials work, , don't (i 401 authorization error maven server), makes me think not ordering tasks.
my thinking loadproperties code happens inside configuration phase (since it's not in dofirst, dolast, or <<, , not in execution phase), i'm not sure how ensure happens before repository block attempts secure authorization.
one possible workaround use gradle.properties file , define myusername , mypassword in them, want gain understanding of how use other properties files , not have rely on gradle.properties.
loading properties file act of configuration, , should done outside task.
Comments
Post a Comment