# Error trying to compile a Maven project with annotations

**URL:** <https://discuss.kotlinlang.org/t/error-trying-to-compile-a-maven-project-with-annotations/698>\
**Category:** Uncategorized\
**Created:** [November 22, 2013, 8:59pm UTC](https://discuss.kotlinlang.org/t/error-trying-to-compile-a-maven-project-with-annotations/698 "2013-11-22T20:59:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarioArias](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/marioarias/32/1488_2.png) [@MarioArias](https://discuss.kotlinlang.org/u/MarioArias)\
**Post date:** [November 22, 2013, 8:59pm UTC](https://discuss.kotlinlang.org/t/error-trying-to-compile-a-maven-project-with-annotations/698/1 "2013-11-22T20:59:25Z")

</div>

I try this mvn configuration

```kotlin
<plugin>
  <artifactId>kotlin-maven-plugin</artifactId>
  <groupId>org.jetbrains.kotlin</groupId>
  <version>${kotlin.version}</version>
  <configuration>
    <annotationPaths>
      <annotationPath>${project.basedir}/src/main/resources/org/springframework/jdbc/core/annotations.xml</annotationPath>
      <annotationPath>${project.basedir}/src/main/resources/org/springframework/jdbc/core/namedparam/annotations.xml</annotationPath>
    </annotationPaths>
  </configuration>

```

The Kotlin version is 0.6.800 (But I try with other versions too)

But always I get this error

```kotlin
[INFO] Using kotlin annotations from /Users/mario/.m2/repository/org/jetbrains/kotlin/kotlin-jdk-annotations/0.6.800/kotlin-jdk-annotations-0.6.800.jar:/Users/mario/IdeaProjects/KotlinProjects/KotlinPrimavera __/KotlinPrimavera/jdbc/src/main/resources/org/springframework/jdbc/core/annotations.xml:/Users/mario/IdeaProjects/KotlinProjects/KotlinPrimavera__ /KotlinPrimavera/jdbc/src/main/resources/org/springframework/jdbc/core/namedparam/annotations.xml
[ERROR] java.lang.IllegalStateException: @NotNull method org/jetbrains/jet/utils/PathUtil.jarFileOrDirectoryToVirtualFile must not return null
     at org.jetbrains.jet.utils.PathUtil.jarFileOrDirectoryToVirtualFile(PathUtil.java:144)
     at org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment.addExternalAnnotationsRoot(JetCoreEnvironment.java:151)
     at org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment.<init>(JetCoreEnvironment.java:120)
     at org.jetbrains.jet.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.java:147)
     at org.jetbrains.jet.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.java:48)
     at org.jetbrains.jet.cli.common.CLICompiler.exec(CLICompiler.java:131)
     at org.jetbrains.kotlin.maven.KotlinCompileMojoBase.execute(KotlinCompileMojoBase.java:202)
     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
     at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
     at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
     at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
     at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
     at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
```

---

<div class="post-metadata">

**Author:** ![programingjd](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/programingjd/32/1526_2.png) [@programingjd](https://discuss.kotlinlang.org/u/programingjd)\
**Post date:** [November 23, 2013, 9:37am UTC](https://discuss.kotlinlang.org/t/error-trying-to-compile-a-maven-project-with-annotations/698/2 "2013-11-23T09:37:10Z")

</div>

That's the same error message I was getting because of this: [http://youtrack.jetbrains.com/issue/KT-4204](http://youtrack.jetbrains.com/issue/KT-4204) See the post "push to maven" from a few days back. The workaround was to rename a parameter.

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [November 25, 2013, 9:01am UTC](https://discuss.kotlinlang.org/t/error-trying-to-compile-a-maven-project-with-annotations/698/3 "2013-11-25T09:01:13Z")

</div>

Stack traces look rather different to me.

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [November 25, 2013, 9:02am UTC](https://discuss.kotlinlang.org/t/error-trying-to-compile-a-maven-project-with-annotations/698/4 "2013-11-25T09:02:52Z")

</div>

You should not specify paths to annotation.xml files. Intead, give a path to the root of the annotation structure (the parent of "org" directory):

```kotlin
<plugin>
  <artifactId>kotlin-maven-plugin</artifactId>
  <groupId>org.jetbrains.kotlin</groupId>
  <version>${kotlin.version}</version>
  <configuration>
    <annotationPaths>
      <annotationPath>${project.basedir}/src/main/resources/</annotationPath>
    </annotationPaths>
  </configuration>
```

Please let me know if it fixes the problem

---

<div class="post-metadata">

**Author:** ![MarioArias](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/marioarias/32/1488_2.png) [@MarioArias](https://discuss.kotlinlang.org/u/MarioArias)\
**Post date:** [November 25, 2013, 9:33pm UTC](https://discuss.kotlinlang.org/t/error-trying-to-compile-a-maven-project-with-annotations/698/5 "2013-11-25T21:33:34Z")

</div>

Perfect, works fine
