/* * This build file was generated by the Gradle 'init' task. * * This generated file contains a sample Java Library project to get you started. * For more details take a look at the Java Libraries chapter in the Gradle * user guide available at https://docs.gradle.org/3.5.1/userguide/java_library_plugin.html
*/
// Apply the java-library plugin to add support for Java Library
apply plugin: 'java-library' apply plugin: 'maven-publish' //只有group 和 version 可以編輯。。project.name 不能修改。。。 project.group="zkdg" project.version="0.1-SNAPSHOT"
// In this section you declare where to find the dependencies of your project
repositories { // Use jcenter for resolving your dependencies. // You can declare any Maven/Ivy/file repository here.
maven { url 'file:///E:/whm/repository/'} //使用file協議,本地倉庫 maven { url 'http://maven.aliyun.com/nexus/content/groups/public/'} // jcenter()
} dependencies { // This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:21.0' compile 'emark:emark-manager:0.0.1-SNAPSHOT' compile 'org.springframework:spring-context:4.3.9.RELEASE'
// Use JUnit test framework
testImplementation 'junit:junit:4.12' } //maven-publish 插件 提交到本地倉庫
publishing { publications { maven(MavenPublication) { groupId project.group artifactId project.name version project.version //若是war包,就寫components.web,若是jar包,就寫components.java
from components.java } } repositories { maven { if (project.version.endsWith('-SNAPSHOT')) { url = "file:///E:/whm/repository/" } else { url = "release版本的倉庫地址" } // credentials { // username 'nexus倉庫用戶名' // password 'nexus倉庫密碼' // }
} } }
gradle publishMavenPublicationToMavenRepository 運行命令(如果失敗,請去掉gradle)
令人蛋疼的是gradle 無法下載文件到maven 倉庫。。。。而是以緩存 存在。。。真夠不習慣的,我還是用maven 吧。。而且 gradle 網上資料也有點少----
不過gradle的語法真的很美,看起來很漂亮。。不過目前來說還不是很好用-----