Closed lukehutch closed 1 year ago
can you have a look @gmariotti ?
I've just tried mvn install
and I got this error when downloading the dependencies.
[WARNING] The POM for io.vertx:vertx-lang-kotlin:jar:4.0.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for io.vertx:vertx-lang-kotlin-coroutines:jar:4.0.0-SNAPSHOT is missing, no dependency information available
Any idea what it means?
The snapshots are available both at https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin-coroutines/ and https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin/ but for some reason, maven doesn't see them
I had to enable snapshots in my .m2/settings.xml
file, and I had to add the Sonatype repository, to get the snapshots to be picked up. I'm traveling right now and won't have access to the computer it's configured on for a couple of days, but it's pretty standard configuration.
Here's what I have in ~/.m2/settings.xml
:
<settings>
<profiles>
<profile>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
</settings>
It still took some coercing to get Maven to actually refresh its indices to pick up the snapshots (it didn't work at first, and I don't even know how I fixed it), but the main setting I needed was the above.
This may be a bug. The information in matedata.xml
shows that the latest snapshot version number is 4.0.0-20190317.171714-38
, but the file name for vertx-lang-kotlin-coroutines
is vertx-lang-kotlin-coroutines-4.0. 0-20190317.170752-37.jar
.
same problem in vertx-lang-kotlin
Nice catch @okou19900722. It might be the travis-ci cache, I look into fixing it this weekend
Maybe we can manually trigger build at travis, it will deploy a new snapshot version
Just tried to rerun the travis-ci with the cache for the master
branch and I don't see this issue occurring, both metadata.xml
for vertx-lang-kotlin
and vertx-lang-kotlin-coroutines
contains a reference to the latest uploaded snapshot
@gmariotti Did you try my test project before closing the bug? It still reports the same errors, even after downloading the latest snapshots (vertx-lang-kotlin-4.0.0-20190330.132534-39.jar
and vertx-lang-kotlin-coroutines-4.0.0-20190330.132534-39.jar
):
$ git clone https://github.com/lukehutch/kotlinproj.git
Cloning into 'kotlinproj'...
remote: Enumerating objects: 45, done.
remote: Counting objects: 100% (45/45), done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 45 (delta 3), reused 40 (delta 1), pack-reused 0
Unpacking objects: 100% (45/45), done.
$ cd kotlinproj/
$ mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< kotlinproj:kotlinproj >------------------------
[INFO] Building kotlinproj 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin/4.0.0-SNAPSHOT/maven-metadata.xml
Downloaded from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin/4.0.0-SNAPSHOT/maven-metadata.xml (1.9 kB at 3.3 kB/s)
Downloading from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin/4.0.0-SNAPSHOT/vertx-lang-kotlin-4.0.0-20190330.132840-33.pom
Downloaded from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin/4.0.0-SNAPSHOT/vertx-lang-kotlin-4.0.0-20190330.132840-33.pom (27 kB at 7.1 kB/s)
Downloading from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin-parent/4.0.0-SNAPSHOT/maven-metadata.xml
Downloaded from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin-parent/4.0.0-SNAPSHOT/maven-metadata.xml (824 B at 4.6 kB/s)
Downloading from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin-parent/4.0.0-SNAPSHOT/vertx-lang-kotlin-parent-4.0.0-20190330.132509-50.pom
Downloaded from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin-parent/4.0.0-SNAPSHOT/vertx-lang-kotlin-parent-4.0.0-20190330.132509-50.pom (2.8 kB at 15 kB/s)
Downloading from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin-coroutines/4.0.0-SNAPSHOT/maven-metadata.xml
Downloaded from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin-coroutines/4.0.0-SNAPSHOT/maven-metadata.xml (1.9 kB at 11 kB/s)
Downloading from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin-coroutines/4.0.0-SNAPSHOT/vertx-lang-kotlin-coroutines-4.0.0-20190330.132534-39.pom
Downloaded from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin-coroutines/4.0.0-SNAPSHOT/vertx-lang-kotlin-coroutines-4.0.0-20190330.132534-39.pom (6.4 kB at 39 kB/s)
Downloading from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin/4.0.0-SNAPSHOT/vertx-lang-kotlin-4.0.0-20190330.132840-33.jar
Downloading from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin-coroutines/4.0.0-SNAPSHOT/vertx-lang-kotlin-coroutines-4.0.0-20190330.132534-39.jar
Downloaded from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin-coroutines/4.0.0-SNAPSHOT/vertx-lang-kotlin-coroutines-4.0.0-20190330.132534-39.jar (52 kB at 111 kB/s)
Downloaded from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-lang-kotlin/4.0.0-SNAPSHOT/vertx-lang-kotlin-4.0.0-20190330.132840-33.jar (2.2 MB at 4.0 MB/s)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ kotlinproj ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /tmp/kotlinproj/src/main/resources
[INFO]
[INFO] --- kotlin-maven-plugin:1.3.21:compile (compile) @ kotlinproj ---
[WARNING] Source root doesn't exist: /tmp/kotlinproj/src/main/kotlin
[WARNING] Using experimental Kotlin incremental compilation
[ERROR] /tmp/kotlinproj/src/main/java/kotlinproj/kotlinproj/Test.kt: (18, 37) Unresolved reference: await
[ERROR] /tmp/kotlinproj/src/main/java/kotlinproj/kotlinproj/Test.kt: (21, 72) Unresolved reference: await
[INFO] Compiled 1 Kotlin files using incremental compiler
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.319 s
[INFO] Finished at: 2019-03-31T18:33:19-06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.21:compile (compile) on project kotlinproj: Compilation failure: Compilation failure:
[ERROR] /tmp/kotlinproj/src/main/java/kotlinproj/kotlinproj/Test.kt:[18,37] Unresolved reference: await
[ERROR] /tmp/kotlinproj/src/main/java/kotlinproj/kotlinproj/Test.kt:[21,72] Unresolved reference: await
[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/MojoFailureException
To specifically point out the error lines:
[ERROR] /tmp/kotlinproj/src/main/java/kotlinproj/kotlinproj/Test.kt: (18, 37) Unresolved reference: await
[ERROR] /tmp/kotlinproj/src/main/java/kotlinproj/kotlinproj/Test.kt: (21, 72) Unresolved reference: await
Sorry, I thought you solved it with the changed settings.xml
. I'll try to give it a look asap
@gmarlottl: The strange thing about this issue is that standard Vertx Kotlin methods seem to work, but extension methods like .await()
are not found. What could cause that?
The Future.await
comes from vertx-lang-kotlin-coroutines
while the others awaitSomething
come from the vertx-lang-kotlin
, that might be the reason. I'm sorry, I didn't have time the last few weeks to look into it, I'll try my best to do it this week.
Hi @lukehutch, sorry for the delay. I was able to pull the snapshots locally adding the following block of code to the pom.xml
and removing the version tag on each dependency.
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-stack-depchain</artifactId>
<version>4.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
I was also able to import the Future.await
and HttpServer.listenAwait
extensions. Unfortunately, my maven knowledge is quite limited, so I'm not really sure why, without that code, I'm able to download the snapshots for vertx-core
and vertx-web
but not for the kotlin libs. Let me know if it works for you.
@gmariotti Thanks, but I have the snapshot jars already in my local repository (I added similar sections to my ~/.m2/settings.xml
file). That's not the problem. The problem is that the extension functions cannot be found, even though the vertx-lang-kotlin-coroutines
jar is found (as far as I can see).
Did you try the repro testcase project I provided above? Adding those lines you suggested to pom.xml
does not fix the problem for me.
Yes, I tried with the testcase project and I was able to import the libraries and import the await*
methods
I just tried adding the lines you provided to the pom.xml
in a clean checkout of the project, and mvn package
still gives the same error messages.
I am attaching the output of mvn -X clean package
. I don't see anything really out of place though, until the error lines Unresolved reference: await
:
I verified that the applicable jar listed in the classpath exists: /home/luke/.m2/repository/io/vertx/vertx-lang-kotlin-coroutines/4.0.0-SNAPSHOT/vertx-lang-kotlin-coroutines-4.0.0-SNAPSHOT.jar
The same problem occurs with both JDK 8 and JDK 11.
Have you imported the extended await method?
@okou19900722 maybe that is the problem. I already had import io.vertx.core.Future
, and I assumed that would also import extension methods on objects of type Future
, but that doesn't seem to be the case -- Future.await
is missing. I tried import io.vertx.core.Future.*
, to no avail, and import io.vertx.core.Future.await
doesn't work. What am I missing?
@lukehutch the right import should be io.vertx.kotlin.coroutines.await
, while all the others await*
extensions are in the io.vertx.kotlin
package
@gmariotti @okou19900722 Thank you! That's what was missing. Sorry for the wild goose chase -- this is the first time I have tried using Kotlin. Can you please add the required import statements for extension methods to the documentation? I could not have guessed which import statements to use, and the Kotlin plugin for Eclipse is apparently not able to auto-add these imports using autocompletion.
Both these sections need updating, for the io.vertx.kotlin.coroutines.await
and io.vertx.kotlin
await*
extensions respectively:
https://vertx.io/docs/vertx-lang-kotlin-coroutines/kotlin/#_suspending_extension_methods
IntelliJ IDEA
has good support for kotlin
Yes, I know, I do need to switch to IntelliJ IDEA. But still, there are people writing Kotlin in Eclipse, Atom, and even probably Emacs/VIM... it would help to list the needed imports.
https://vertx.io/docs/kdoc/vertx/
some kdoc missed, Maybe someone will solve it, maybe I will
Import statements should always be auto-added to generated docs in the case of extension functions, because it's very hard to predict where they come from.
See minimal reproducer project:
https://github.com/lukehutch/kotlinproj/tree/master
This is with
4.0-SNAPSHOT
versions.