[英]How do I publish a grails 3 plugin to my local nexus repo?
運行grails publish-plugin
似乎沒有任何作用,我能找到的唯一文檔是關於發布到 bintray 的。
[編輯:]
我可以通過gradle publish
發布插件,但想知道是否有 grails-y 的方式來做到這一點,並且想知道grails publish-plugin
到底做了什么:/
我在http://rvanderwerf.blogspot.com/2015/07/how-to-publish-grails-3-plugin.html的Ryan Vanderwerf的幫助下弄明白了,他寫道有一堆 spring-boot 依賴項它們中沒有版本,這會導致 gradle 崩潰。 要解決它,請刪除 pom 中沒有版本的所有依賴項:
publishing {
publications {
mavenJar(MavenPublication) {
pom.withXml {
def pomNode = asNode()
pomNode.dependencyManagement.replaceNode {}
// simply remove dependencies without a version
// version-less dependencies are handled with dependencyManagement
// see https://github.com/spring-gradle-plugins/dependency-management-plugin/issues/8 for more complete solutions
pomNode.dependencies.dependency.findAll {
it.version.text().isEmpty()
}.each {
it.replaceNode {}
}
}
from components.java
}
}
repositories {
maven {
credentials {
username "username"
password "password"
}
url "http://localhost/repo"
}
}
}
然后你可以使用grails publish-plugin
或gradle publish
來發布你的插件
相關 SO 問題: Grails 3 - 如何發布到 Artifactory
在 Grails 3.0.11 中,我使用 gradle 目標publishToMavenLocal進行本地開發。 還有另一個目標publishMavenPublicationToMavenRepository 。 這似乎來自 gradle 插件:
apply plugin: 'maven-publish'
似乎在標准插件 build.gradle 中。
(編輯:添加關於使用本地 maven 的注釋)。
在重新閱讀您的問題和下面的評論后,我認為這不是您要找的。 聽起來您想正常發布到系統上的存儲庫。 publishMavenPublicationToMavenRepository
可以處理這個問題。 我上面描述的是使用本地 Maven 緩存來保存插件的快照,您可以在應用程序中使用您的機器。
在開發我的應用程序中使用的插件時,這對我有用。
我沒有創建本地存儲庫。 上面的 gradle 插件 ( maven-publish
) 有一個publishToMavenLocal
任務,它將把 Grails 插件發布到本地 maven 緩存以進行本地開發。
它將插件的.zip 文件存儲在.m2 緩存目錄中:
C:\Users\xyz\.m2\repository\org\whatever\plugins\pluginName\0.3-SNAPSHOT
然后,您可以在計算機上的 Grails 應用程序中使用該插件。
在 grails 2.x BuildConfig.groovy 中
grails.project.dependency.distribution = {
remoteRepository(id: '<repo name>', url: '<url to your nexus repo>')
}
Then:
grails clean
grails compile
grails maven-deploy --repository=repo name
在 grails 3.x+ 中:
buildscript {
repositories {
mavenLocal()
...
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
}
}
publishing {
repositories {
maven {
credentials {
username "xyz"
password "xyz"
}
url "http://example.com/nexus/content/repositories/nfb"
}
}
}
最后
漸變發布
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.