![](/img/trans.png)
[英]Task 'bintrayUpload' not found in root project 'bin'
[英]Task 'install' not found in root project gradle
我正在嘗試使用 Maven 插件將我的 Gradle 項目轉換為 Maven。 我正在關注此SO 鏈接,但是當我運行 Gradle install 命令時出現以下錯誤
C:\Users\>gradle install
FAILURE: Build failed with an exception.
* What went wrong:
Task 'install' not found in root project .
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log outpu
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
當我執行gradle -tasks
它沒有顯示安裝。 在這該怎么辦?
您可能指的是https://docs.gradle.org/current/userguide/build_init_plugin.html 中描述的gradle init
嗎?
如果您將install
任務應用到您沒有執行的構建中,則maven
插件會添加install
任務。 它將構建的工件安裝到您的本地 maven 存儲庫。 在你的情況下,這不是你想要的。 無論如何,我建議使用maven-publish
插件而不是maven
插件。
如果您添加apply plugin: 'maven'
gradle install
會創建一個 POM。
Gradle 腳本是這樣的。
buildscript {
repositories {
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
maven { url "https://repo1.maven.org/maven2/" }
mavenLocal()
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.5.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: "org.springframework.boot"
apply plugin: 'io.spring.dependency-management'
jar {
baseName = 'Angular-Boot-Rest'
version = '0.1.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "http://repo.spring.io/libs-release" }
}
tasks.withType(Copy) {
eachFile { println it.file }
}
jar {
enabled = true
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("junit:junit")
}
task stage(dependsOn: ['clean','build','jar', 'installApp']){}
創建的POM是這樣的。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId/>
<artifactId>Angular-Boot-Rest</artifactId>
<version>unspecified</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>tomcat-annotations-api</artifactId>
<groupId>org.apache.tomcat</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.5.RELEASE</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
</project>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.