Gradle項目在IDEA中運行時提示:Unnecessarily replacing a task that does not exist is not supported. Use create() or register() directly instead.


場景

在IDEA中新建Gradle項目后,使用Java語言。

新建類后添加main方法,然后運行main方法釋提示:

could not create task ':HelloWorldServer.main()'.
   > Unnecessarily replacing a task that does not exist is not supported.  Use create() or register() directly instead.

 

 

 

 

 

 

 

 

注:

博客:
https://blog.csdn.net/badao_liumang_qizhi
關注公眾號
霸道的程序猿
獲取編程相關電子書、教程推送與免費下載。

實現

這是因為在運行main方法時,gradle並沒有識別,將其認為是一個task。

來到項目下的.idea下的gradle.xml文件

將下面的設置改為false

<option name="delegatedBuild" value="false" />

如果沒有則添加該配置。

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM