Maven Project in Eclipse Problems

Hi,
Brand new Kotlin user here and a bit stuck at the first hurdle to be honest. Would really appreciate any assistance - hopefully this is a simple one for somebody.

I’m using Eclipse Version: Neon.3 Release (4.6.3). I have added Kotlin Plugin for Eclipe 0.8.2.

I can create a new Kotlin project and run it. No issues or problems (but very simple, like a 'hello world"), but it works okay and it’s a start.

If I then convert that project to a Maven project, to start adding dependencies and make the whole thing a lot more interesting… bang! Nothing works. Even simple:

println("hello world")

Then turns red and produces a:

Unresolved reference: println

My pom looks like:

<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>Testy</groupId>
  <artifactId>Testy</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resource>
        <directory>src</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source/>
          <target/>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

Would really appreciate any assistance with resolving this.

Thanks

You are using the Maven compiler plug-in which compiles Java. See these examples for how to set up a Maven Kotlin project.

1 Like

@jstuyts

Thank you and apologies for the delayed response. Yes, using the example pom from the link you provided got things going again.

-Much appreciated!