gpt4 book ai didi

android - Gradle 'publishToMavenLocal' 任务未找到。请添加 'maven-publish' 或 'maven' 插件

转载 作者:行者123 更新时间:2023-12-05 01:23:23 26 4
gpt4 key购买 nike

当我在 jitpack eoor 上部署我的库时出现错误,如下所示。我用过项目完整错误在这里--->

构建开始...开始时间:UTC 2022 年 5 月 27 日星期五 13:31:41 67cf7f81daef git :edb3881提交 edb38816aca77f5b11d1a2be6fbe604d3e1e088c添加一名作者日期:2022 年 5 月 27 日星期五 19:00:52 +0530

这是我的提交:-->全部添加

    Init SDKMan
Found Android manifest
Android SDK version: . Build tools:
Found gradle
Gradle build script
Found gradle version: 7.0.2.
Using gradle wrapper
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Downloading https://services.gradle.org/distributions/gradle-7.0.2-bin.zip
.10%.20%.30%.40%.50%.60%.70%.80%.90%.100%

------------------------------------------------------------
Gradle 7.0.2
------------------------------------------------------------

Build time: 2021-05-14 12:02:31 UTC
Revision: 1ef1b260d39daacbf9357f9d8594a8a743e2152e

Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_292 (Private Build 25.292-b10)
OS: Linux 4.14.63-xxxx-std-ipv6-64 amd64

0m3.269s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~16.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
Getting tasks: ./gradlew tasks --all
WARNING: > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
Please specify Java version in jitpack.yml
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
JVM: 11.0.2 (Oracle Corporation 11.0.2+9)
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Tasks:

⚠️ WARNING:
Gradle 'publishToMavenLocal' task not found. Please add the 'maven-publish' or 'maven' plugin.
See the documentation and examples: https://docs.jitpack.io

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Running: ./gradlew clean -Pgroup=com.github.codewith-fun -Pversion=edb38816ac -xtest -xlint
publishToMavenLocal

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See
https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2

FAILURE: Build failed with an exception.

* Where:
Build file '/home/jitpack/build/app/build.gradle' line: 2

* What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
> Your project contains 2 or more modules with the same identification com.github.codewith-
fun:investwell
at ":" and ":investwell".
You must use different identification (either name or group) for each modules.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get
more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Build tool exit code: 0
Looking for artifacts...
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Looking for pom.xml in build directory and ~/.m2
2022-05-27T13:32:53.067115286Z
Exit code: 0

⚠️ ERROR: No build artifacts found

最佳答案

  1. 打开项目的 build.gradle 文件。

  2. 添加对 Maven 插件的引用:应用插件:'maven-publish'

  3. 在发布部分,指定包属性(生成的包名称将为 groupId:artifactId)。比如我们要发布一个.jar文件(为了篇幅,减少了章节内容):

publishing {
publications {
maven(MavenPublication) {
groupId = 'org.company'
artifactId = 'sample'
version = "0.9-SNAPSHOT"
from components.java

pom {
description = 'A description of my library'
...
}
}
}
}

关于android - Gradle 'publishToMavenLocal' 任务未找到。请添加 'maven-publish' 或 'maven' 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72429685/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com