简体   繁体   中英

Netbeans to use pom.xml (Maven) instead of build.gradle (Gradle)

Our team has a Netbeans 11.0 project that (at the root level) contains both a pom.xml file and a build.gradle file. When opening the project within Netbeans it assumes it is a Gradle project and treats it as such. However the default should be to open as a Maven project, allowing the pom.xml to take precedence.

Is there any configuration within Netbeans that will tell it that this is a Maven project (to use the pom.xml file) and treat it as such?

(note, if we close the project, temporarily delete the build.gradle file, then re-open in Netbeans, it does open as expected as a Maven project)

Now on newer versions (using 12 here), in Tools/Options/Java/Gradle exists a checkbox "Prefer Maven Projects over Gradle (needs restart)", check that and you have the solution.

It seems that Netbeans 11 and newer will consider the project as gradle if both pom.xml and build.gradle files exist in the project.

I had the same problem and found no option to tell Netbeans that I want to treat my project as being maven and not gradle.

Solution is (as @skomisa commented) to rename build.gradle and settings.gradle to something else like build.gradle_disabled , settings.gradle_disabled and then Netbeans will see your project as maven

The only way I managed to convince netbeans 11 to use my pom.xml: Close the project, close netbeans. Clean up the cache folder (in Linux: ~/.cache/netbeans/11.0) Restart netbeans, reopen the project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM