Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

NPE with 0.13.0 and Maven #117

Closed
mhlz opened this issue Nov 30, 2017 · 1 comment
Closed

NPE with 0.13.0 and Maven #117

mhlz opened this issue Nov 30, 2017 · 1 comment

Comments

@mhlz
Copy link

mhlz commented Nov 30, 2017

Using 0.13.0 with the supplied Maven configuration seems to not work right now. I have a MCVE up at https://github.com/mhlz/ktlint-issue (but it really is just using the example configuration).

Running mvn antrun:run@ktlint results in this output:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (ktlint) @ test ---
[INFO] Executing tasks

ktlint:
   [ktlint] Exception in thread "main" java.lang.IllegalStateException: locator.getService(RepositorySystem::class.java) must not be null
   [ktlint]     at com.github.shyiko.ktlint.internal.MavenDependencyResolver.<init>(MavenDependencyResolver.kt:35)
   [ktlint]     at com.github.shyiko.ktlint.Main.buildDependencyResolver(Main.kt:513)
   [ktlint]     at com.github.shyiko.ktlint.Main.access$buildDependencyResolver(Main.kt:56)
   [ktlint]     at com.github.shyiko.ktlint.Main$main$dependencyResolver$2.invoke(Main.kt:241)
   [ktlint]     at com.github.shyiko.ktlint.Main$main$dependencyResolver$2.invoke(Main.kt:56)
   [ktlint]     at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)
   [ktlint]     at com.github.shyiko.ktlint.Main.main(Main.kt:252)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.959 s
[INFO] Finished at: 2017-11-30T11:59:37+01:00
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (ktlint) on project test: An Ant BuildException has occured: Java returned: 1
[ERROR] around Ant part ...<java fork="true" classname="com.github.shyiko.ktlint.Main" taskname="ktlint" failonerror="true" dir="/Users/mhlz/ktlint-issue" classpathref="maven.plugin.classpath">... @ 4:169 in /Users/mhlz/ktlint-issue/target/antrun/build-ktlint.xml
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
@shyiko
Copy link
Collaborator

shyiko commented Nov 30, 2017

Thank you, @mhlz. Fixed in 0.14.0.

@shyiko shyiko closed this as completed Nov 30, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants