Use gradle to upload jar to local Maven repository

后端 未结 2 829
一个人的身影
一个人的身影 2021-01-12 14:45

This question has been asked several times, but somehow I don\'t get this to work. Gradle is a great tool, but its documentation is anything but great. No examples make it a

2条回答
  •  [愿得一人]
    2021-01-12 15:01

    Peter N is CORRECT in the comments of the accepted answer, which works, but shouldn't be the accepted answer.

    You should have this in your build.gradle file

    apply plugin: "maven"
    

    Then you can just do a

    $ ./gradlew install
    

    Or use the built-in task

    $ ./gradlew publishToMavenLocal
    

    Both methods install the artifacts in $HOME/.m2/com/example/example/version

提交回复
热议问题