No build.gradle nor pom.xml

已回答

Often, when trying to add something to IntelliJ, I'm told to simply add something to my build.gradle or pom.xml file.  I don't have either.  I've never used Maven nor Gradle (but I'm a beast with Makefiles).

My current issue is with kotlinx-cli.

Am I supposed to create these files, or what?

0

Hi Jim, build.gradle is for Gradle-managed projects, and pom.xml is for Maven-managed projects.

You can create a new Gradle-managed project by following the steps in https://www.jetbrains.com/help/idea/getting-started-with-gradle.html#create_project, and for maven, please refer to https://www.jetbrains.com/guide/java/tutorials/working-with-maven/creating-a-project/ .

If you want to turn your existing project into gradle-managed or maven-managed, please follow these instructions:

Maven

  • Create pom.xml in the project root:
    • In the Project tool window, right-click the project root → New | File → name it pom.xml.
  • Add basic Maven coordinates/config to pom.xml (at minimum groupId, artifactId, version, and packaging if needed).
  • Save the file – IDEA will detect the Maven build script and show a notification like “Maven project detected” / “Load Maven Project”.
  • Click Load Maven Project in that notification.

Gradle

  • Create a Gradle build script in the project root:
    • Right-click the project root → New | File → name it build.gradle (or build.gradle.kts for Kotlin DSL).
  • Add a minimal Gradle configuration (plugins, repositories, dependencies, etc.).
  • Save the file – IDEA will recognize it as a Gradle build script and show a notification suggesting to load the project as Gradle.
  • Click the Load as Gradle / Load Gradle Project link in the notification.
0

请先登录再写评论。