OpenLiberty / guide-maven-intro

An introductory guide on how to build applications using Maven on Open Liberty: https://openliberty.io/guides/maven-intro.html
Other
20 stars 34 forks source link

Sample project does not work on Fedora 30/31 #65

Closed thucke closed 4 years ago

thucke commented 4 years ago

Following your instructions on a current Fedora 30 box mvn install fails as followed:

[INFO] --- liberty-maven-plugin:3.0.M1:install-server (create-server) @ ServletSample --- Downloading from central: https://repo.maven.apache.org/maven2/io/openliberty/openliberty-runtime/maven-metadata.xml [WARNING] Could not transfer metadata io.openliberty:openliberty-runtime/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): User-specified log class 'org.codehaus.mojo.pluginsupport.logging.DelegatingLog' cannot be found or is not useable. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.942 s [INFO] Finished at: 2019-11-05T17:11:33+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal net.wasdev.wlp.maven.plugins:liberty-maven-plugin:3.0.M1:install-server (create-server) on project ServletSample: Unable to resolve artifact: io.openliberty:openliberty-runtime:RELEASE: Failed to resolve version for io.openliberty:openliberty-runtime:zip:RELEASE: Could not find metadata io.openliberty:openliberty-runtime/maven-metadata.xml in local (/home/thucke/.m2/repository) -> [Help 1]

Doing the same on a Rasperry Pi (Debian Stretch) finishes successfully. Fedora is updated to the last state.

Edit: Same error on a fresh installation of Fedora 31. Edit 2: Perhaps an issue concerning the liberty-maven-plugin?

Any ideas? Thanks for your support.

MaiHameed commented 4 years ago

Hello @thucke,

Thanks for bringing this to our attention. I tried running the mvn install command on a CentOS VM that I had, and it ran successfully, so my initial assumption is that it might be a Fedora specific issue. I'm deploying a Fedora 31 VM and will see if I can reproduce the issue.

In the meantime, from the error logs, it seems that Maven was unable to pull the necessary dependancy. Checking my installation result, the contents of the dependancy is in the following file /root/.m2/repository/io/openliberty/openliberty-runtime/maven-metadata-central.xml. My suggestion would be to add the contents of the file I linked to you into the file given in the path I mentioned, and run the mvn install command again to see if it picks up the file. Try renaming it from maven-metadata-central.xml to maven-metadata.xml in case it doesn't work. If that still doesn't work, try deleting the .m2/repository and re-run mvn install inside the finish/ directory to see if it changes anything.

If those still don't work, please provide some environment details so I can try re-creating the error once my Fedora VM is installed. Specifically I'll need the Maven and Java versions. The output of mvn -v should suffice.

Cheers!

thucke commented 4 years ago

Hallo @MaiHameed,

I appreciate your support - thank you a lot! I've followed your instructions unfortunately without gaining any change in the result. Hopefully you may be able to reproduce the issue in your Fedora VM.

Finally the requested output of mvn -v:

Apache Maven 3.5.4 (Red Hat 3.5.4-5) Maven home: /usr/share/maven Java version: 1.8.0_232, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.fc30.x86_64/jre Default locale: de_DE, platform encoding: UTF-8 OS name: "linux", version: "5.3.7-200.fc30.x86_64", arch: "amd64", family: "unix"

Ah - maybe it would help: Your sample project for Gradle works out of the box on any platform.

Edit: The file you're referencing was completely absent in the directory.

Greets Thomas

MaiHameed commented 4 years ago

Hello @thucke

Ah, sorry to see it didn't work out for you. I just finished testing on my Fedora 31 platform, and it worked without any errors. At this point I'm thinking that it might be an error with the Maven version itself, see if you can install the latest version of Maven, it should be 3.6.2 as far as I know.

Were there any additional errors or warnings outputted by the install command before the one specified? There might be a root error that we need to fix that causes the one you mentioned.

In addition, can you verify that the Java that Maven is referencing is a JDK? From the output you showed it seems to be running a JRE instead. Could you provide the result of the following: java -version, which java, and echo $JAVA_HOME.

Let's see if you can match my environment and get it to work. I'm running the OpenJ9 JDK11. Try setting your Java environment variables to the Java JDK I used here. Let me know if you need help with configuring your environment :)

Cheers!

thucke commented 4 years ago

Hi @MaiHameed,

problem solved - the issue was the installed Maven 3.5.2. First I tried updating Java to your provided version - without success. After that I've downloaded Maven 3.6.2 and tried mvn install using that - Bingo! Crosschecking with Java 1.8 works also.

Thank you very much.

Still a bit weird is that on my Raspberry Pi a successful command execution is still possible using Maven 3.3.9

MaiHameed commented 4 years ago

I'm glad I was able to help, feel free to open additional issues if you come across another problem.

Cheers!