J.Olufsen
J.Olufsen

Reputation: 13915

Cannot run project which has Maven integration

I installed Maven to be able to easily import / manage dependencies for org.apache.commons:comons-lang3:3.1. After opening pom.xml the project can not be run or debugged. pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>myGroup</groupId>
  <artifactId>myArtifact</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>deleteme</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.1</version>
    </dependency>
  </dependencies>
</project> 

The Run and Debug buttons became inactive. enter image description here

Upvotes: 0

Views: 176

Answers (1)

Milan Baran
Milan Baran

Reputation: 4232

This has nothing with maven. It about IntelliJ setup! Actually, maven has slightly different file structure

/project-root
  /src
    /main
      /java <-- put your sources here
      /resources
    /test
      /java 
      /resources
/your-packages-and-sources <-- now your sources is probably here
pom.xml

Try to:

  • right click on your project and "Add framewrok support" select maven.
  • right click on your package and "Mark directory as" -> "Source root"
  • copy your sources to maven source dir -> src/main/java

Upvotes: 1

Related Questions