Use gradle to upload jar to local Maven repository

后端 未结 2 830
一个人的身影
一个人的身影 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条回答
  •  猫巷女王i
    2021-01-12 14:59

    I suspect the problem is that you are only editing the POM (via pom.project), instead of configuring the actual Maven coordinates used for installation. Try the following instead:

    // best way to set group ID
    group = 'com.example'
    
    install {
        repositories.mavenInstaller {
            // only necessary if artifact ID diverges from project name
            // the latter defaults to project directory name and can be
            // configured in settings.gradle
            pom.artifactId = 'myName' 
            // shouldn't be needed as this is the default anyway
            pom.packaging = 'jar'
        }
    }
    

    PS: The samples directory in the full Gradle distribution contains many example builds, also for the maven plugin.

提交回复
热议问题