2

I'm trying to create an executable jar for my JavaFX application within an Eclipse Maven Project.

I'm following this thread: JavaFx Application with Maven in Eclipse

And this turotial: https://www.youtube.com/watch?v=wbjW8rYlook

I'm getting a
No plugin found for prefix 'jfx' in the current project and in the plugin groups
error when trying to run the goal: jfx:jar

Full build error:

[INFO] Scanning for projects...
[INFO] Downloading: https://repo.maven.apache.org/maven2/com/zenjava/javafx-maven-plugin/8.1.2/javafx-maven-plugin-8.1.2.pom
[WARNING] Failed to retrieve plugin descriptor for com.zenjava:javafx-maven-plugin:8.1.2: Plugin com.zenjava:javafx-maven-plugin:8.1.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for com.zenjava:javafx-maven-plugin:jar:8.1.2
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-release-plugin/2.3.2/maven-release-plugin-2.3.2.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-release-plugin:2.3.2: Plugin org.apache.maven.plugins:maven-release-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-release-plugin:jar:2.3.2
[INFO] Downloading: https://repo.maven.apache.org/maven2/com/zenjava/maven-metadata.xml
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
[WARNING] Could not transfer metadata com.zenjava/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[WARNING] Failure to transfer com.zenjava/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata com.zenjava/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.831 s
[INFO] Finished at: 2017-01-18T15:36:52+08:00
[INFO] Final Memory: 9M/22M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'jfx' in the current project and in the plugin groups [com.zenjava, org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\alexismatunog\Documents\My Docs\03_OE\Java\workspace\Maven\m2\repository), central (https://repo.maven.apache.org/maven2)] -> [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/NoPluginFoundForPrefixException

I've already tried the following in attempt to solve this problem:
1. Enter mvn clean install (BUILD SUCCESS)
2. Added <pluginGroup>com.zenjava</pluginGroup> on settings.xml

Also, I've already added the <plugin> node in my pom.xml

    <plugin>
        <groupId>com.zenjava</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>8.1.2</version>
        <configuration>
            <mainClass>com.sample.MainApp</mainClass>
        </configuration>
    </plugin>

How can I solve this problem?

===========================================================
UPDATE 1:
After following Jaydeep's answer, I'm getting a password prompt after trying to open the cacerts file and unable to proceed further.
IMG1

===========================================================
UPDATE 2:
Default password for cacerts is "changeit". Build is successful after importing the root cert. Also, I've updated my pom file with jfx plugin version 8.7.0 as advised by FibreFoX.

Community
  • 1
  • 1
iamkenos
  • 1,446
  • 8
  • 24
  • 49
  • It seems that you are only using apache-repositories, not maven-central. Your should upgrade to plugin-version 8.7.0 too, as it contains latest bugfixes and workarounds. Disclaimer: I'm the maintainer of the project. – FibreFoX Jan 18 '17 at 18:09
  • @FibreFoX thanks, I was actually expecting for your reply as I see your name all over the web on jfx maven plugin threads. Can you explain what `only using apache-repositories, not maven-central` mean please? I'm relatively new with maven setup. I do know that my project is already converted to a maven project (Eclipse convert to maven). Do I need to do further steps to use maven-central? – iamkenos Jan 19 '17 at 01:42
  • if you have further questions, don't hesitate to drop me that question via email :) always happy to help here. And to make it clear: KUDOS here are required to got to jaydeep, I was wrong, he was right :) (I think it was too few sleep for me xD) – FibreFoX Jan 19 '17 at 09:05

2 Answers2

8

You need to install your network ssl certificate to your jre cacerts.

Step 1 : Get certificate.

  1. Open https://repo.maven.apache.org URL using chrome browser.
  2. Click on view certificate
  3. select Top most certificate on chain and drag and drop to desktop. enter image description here

Step 2 : install certificate to cacerts

  1. open command prompt or terminal and type command

mvn -version

  1. Grab path to jre which would be shown to your after typing above command.
  2. Download this tool.
  3. select open option in that tool and navigate to that path which you grabbed at point 2. Now you are at jre folder. Open lib folder. Open security folder.(YOURMAVENJDKPATH/jre/lib/security/cacerts)
  4. Select cacerts file located in that security folder.Now you can see all the certificates in that tool. Tool would ask for password enter "changeit"(without double quote string changeit is the password)
  5. find out import certificate icon and click on it.
  6. Select the certificate which you downloaded in step 1.
  7. Save your changes and close the tool.

Now your problem is resolved.

positivecrux
  • 1,307
  • 2
  • 16
  • 35
  • Hi, im having trouble following these steps from your first link: `3. Click on View Certificate.You can see hierarchy and select top most certificate in hierarchy 4. Confirm that certificate have ROOT word in its name. 5. Now just bellow that hierarchy part you can see a rectangle image of the certificate. Just drag that image and drop it to your desktop.` I can see the cert hierarchy but I'm unable to tell which one is the root. (I can't see the word root anywhere.) Also, current chrome version seem to restrict dragging of certs. Pls advise. Thanks! – iamkenos Jan 18 '17 at 10:01
  • Also, How exactly do I use the keystore tool? I tried to follow the following from the first link again: `1. use keytool.exe inside your jre bin folder. 2. fire following command to place your certificate inside cacerts file` but keytool.exe just closes after double-clicking it. thanks. – iamkenos Jan 18 '17 at 10:11
  • @Kenos updated answer with rich details. if possible keep single jdk to be used by all the apps on system. – positivecrux Jan 18 '17 at 12:50
  • How does this resolving the problem, that the plugin is not get downloaded from maven-central, but from apache directly. Adding some certificate won't bring the dependency/plugin into that repository. – FibreFoX Jan 18 '17 at 18:12
  • 1
    @FibreFoX just copy paste each and every link which is appearing after Downloading word in log. all links resources are available but next line is failed because of PKIX ssl certificate issue. when dependencies are getting download and not found it gives 404 error but when it is found but there is issue with PKIX path building errror it is always certificate issue. – positivecrux Jan 18 '17 at 18:21
  • 1
    @jaydeep indeed ... maybe you should have copy-pasted them as part of your answer, because that is really not as clear, even to others ... wondering why this even happens ... – FibreFoX Jan 18 '17 at 19:53
  • 1
    @jaydeep, thanks for the details. I follow everything so far but it's asking for a password after selecting cacerts. Is this normal? I've updated the question with the screenshot. – iamkenos Jan 19 '17 at 01:38
  • @FibreFoX Thanks for updating answer! – positivecrux Jan 19 '17 at 09:07
  • 1
    @jaydeep I'm not THAT type of ignorant developer ;) and you was right ! – FibreFoX Jan 19 '17 at 09:16
  • 1
    I had this issue on my Android Studio and this worked for me. I had to also make sure that Android Studio was using the same java. Thanks!!!! – Rubin Yoo Oct 20 '20 at 22:25
0

There's a shorter way to install your network ssl certificate to your jre cacerts:

mvn -version

and copy the path to Java.

openssl s_client -connect mysite.org:443 | openssl x509 -out my_ssl.cert

to download the certificate to your local home directory.

sudo keytool -import -alias mvn_certificate -file my_ssl.cert -keystore PATH_FROM_STEP_ONE/lib/security/cacerts

and enter your account password and then 'changeit' if requested.

German
  • 10,263
  • 4
  • 40
  • 56