Gradle Clean安装 - 任务'安装'在根项目中找不到

发布于 2025-01-19 07:02:34 字数 270 浏览 6 评论 0原文

我正在尝试使用 gradle 构建应用程序 :

执行上述命令时出现错误,如下所示 在根项目中找不到任务“安装”

根据文档,插件 - maven 在 gradle 7.4 下被删除。所以我使用 插件 - maven-publish 推荐用于 7.4

目前我使用以下版本
Java - 11
Gradle - 7.4

如果该问题有任何解决方案,请告诉我

I am trying to build the application using gradle
gradlew clean install

while executing the above command got error as,
Task 'install' not found in root project

As per the documentation, plugin - maven is removed under gradle 7.4 . So I am using plugin - maven-publish which is recommended for 7.4

Currently I am using below versions
Java - 11
Gradle - 7.4

Please let me know if there is any solution for the issue

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请爱~陌生人 2025-01-26 07:02:34

很难猜测,实际的gradle看不到。

当我通过5.5到7.4.2时,我也有类似的问题。错误是相同的:在root项目中找不到任务“安装”。

我只是将所有“编译”更改为依赖项声明中的“实现”,以执行以下书面的完整迁移。
然后,通过“构建”项目,所有依赖项已下载和索引。

自Gradle 3.4以来,不建议使用Java生态系统插件中的编译和运行时配置。
这些配置用于从主源集中编译和运行代码。其他来源集创建相似的配置(例如测试源集的TestCompile和TestRuntime),也不应使用。应使用实现,API,编译和运行时间配置来声明依赖关系以及CompileClassPath和RuntimeClassPath配置以解决依赖关系。

参考:

https://docs.gradle.org/7.0/userguide/upgrading_version_5.html#deppedencies_should_no_no_no_no_no_be_declared_the_compile_compile_compile_compile_runtime_runtime_configuration弃用的Gradle Maven插件(Maven)。您应该使用现代的Gradle Maven Publish插件(Maven-Publish)及其任务Publishtomavenlocal。

对于与本地Maven安装集成,有时将模块发布到Maven Local存储库(通常在$ user_home/.m2/储存库中)以及其POM文件和其他元数据很有用。在maven的列表中,这称为“安装”模块。

参考:
noreferrer'> referecation install

!还要注意其他弃用的任务和新的Sintaxes。您会在同一文档中找到详细信息

its difficult to guess cause it's not visible the actual gradle.

I had a similar issue when I passed from 5.5 to 7.4.2. The error was the same: Task 'install' not found in root project.

I had just to change all the 'compile' into 'implementation' in the dependencies declaration to execute a complete migration as it is written below.
Then by "build" the project all the dependency has been downloaded and indexed.

The usage of the compile and runtime configurations in the Java ecosystem plugins has been discouraged since Gradle 3.4.
These configurations are used for compiling and running code from the main source set. Other sources sets create similar configurations (e.g. testCompile and testRuntime for the test source set), should not be used either. The implementation, api, compileOnly and runtimeOnly configurations should be used to declare dependencies and the compileClasspath and runtimeClasspath configurations to resolve dependencies.

ref: change compile

However, the Gradle task install is part of the deprecated Gradle Maven plugin (maven). You should use the modern Gradle Maven Publish plugin (maven-publish) and its task publishToMavenLocal.

For integration with a local Maven installation, it is sometimes useful to publish the module into the Maven local repository (typically at $USER_HOME/.m2/repository), along with its POM file and other metadata. In Maven parlance, this is referred to as 'installing' the module.

ref:
deprecation install

!! also pay attention to the other deprecated task and the new sintaxes. You will find details in the same docs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文