{"id":1845,"date":"2023-03-29T21:57:05","date_gmt":"2023-03-29T13:57:05","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1845"},"modified":"2023-04-22T09:11:06","modified_gmt":"2023-04-22T01:11:06","slug":"gradle-sets-nexus-username-and-password","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/29\/gradle-sets-nexus-username-and-password\/","title":{"rendered":"Gradle \u8bbe\u7f6e Nexus \u7528\u6237\u540d\u5bc6\u7801"},"content":{"rendered":"<p>\u76f4\u63a5\u5728<code>Gradle<\/code>\u4e2d\u660e\u6587\u5199\u4e0a\u7528\u6237\u540d\u3001\u5bc6\u7801\u4e0d\u4ec5\u4f1a\u6d89\u53ca\u5b89\u5168\u6027\u95ee\u9898\uff0c\u66f4\u4e3a<code>Git<\/code>\u7684\u7ba1\u7406\u5e26\u6765\u8bf8\u591a\u4e0d\u4fbf\u3002<\/p>\n<p>\u6709\u4e00\u4e2a\u53d8\u901a\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>\u65b0\u5efa\u4e00\u4e2a<code>Gradle<\/code>\u5c5e\u6027\u6587\u4ef6<code>~\/.gradle\/gradle.properties<\/code>\uff0c\u53ef\u4ee5\u5c06\u7528\u6237\u540d\u3001\u5bc6\u7801\u4ee5\u53d8\u91cf\u7684\u5f62\u5f0f\u5b58\u5165\u6587\u672c\uff1a<\/p>\n<p><!-- more --><\/p>\n<pre><code>NEXUS_USER=yourname\nNEXUS_PASSWORD=yourpassword<\/code><\/pre>\n<p>\u63a5\u7740\u5728<code>Gradle<\/code>\u6587\u4ef6\u4e2d\u5373\u53ef\u5f15\u7528\u4e0a\u8ff0\u53d8\u91cf\uff1a<\/p>\n<pre><code>allprojects {\n    repositories {\n        jcenter()\n        maven {\n            url &quot;http:\/\/ip:port\/repository\/maven-releases\/&quot;\n            credentials {\n                username = &quot;${NEXUS_USER}&quot;\n                password = &quot;${NEXUS_PASSWORD}&quot;\n            }\n        }\n    }\n}<\/code><\/pre>\n<pre><code>uploadArchives {\n    configuration = configurations.archives\n    repositories {\n        mavenDeployer {\n            repository(url: &quot;http:\/\/ip:port\/repository\/maven-releases\/&quot;) {\n                authentication(userName: NEXUS_USER, password: NEXUS_PASSWORD)\n            }\n            pom.project {\n                version &#039;1.0.0&#039;\n                artifactId &#039;pay&#039;\n                groupId &#039;me.yezhou&#039;\n                packaging &#039;aar&#039;\n                description &#039;pay library&#039;\n            }\n        }\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u76f4\u63a5\u5728Gradle\u4e2d\u660e\u6587\u5199\u4e0a\u7528\u6237\u540d\u3001\u5bc6\u7801\u4e0d\u4ec5\u4f1a\u6d89\u53ca\u5b89\u5168\u6027\u95ee\u9898\uff0c\u66f4\u4e3aGit\u7684\u7ba1\u7406\u5e26\u6765\u8bf8\u591a\u4e0d\u4fbf\u3002 \u6709\u4e00\u4e2a\u53d8\u901a\u7684\u65b9\u6cd5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[202],"tags":[64,475],"class_list":["post-1845","post","type-post","status-publish","format-standard","hentry","category-android-build","tag-gradle","tag-nexus"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1845","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1845"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1845\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}