Search code examples
javamavenjsoup

Try to install Jsoup with maven,


i'm trying to install Jsoup library with maven. I've followed all steps but every time i get the same error:

[INFO] Building jsoup Java HTML Parser 1.12.1-SNAPSHOT [INFO]
 Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/3.0.1/maven-resources-plugin-3.0.1.pom [INFO]
[INFO] BUILD FAILURE [INFO]
[INFO] Total time: 0.902 s [INFO] Finished at: 2018-06-26T12:36:38-07:00 [INFO] Final Memory: 8M/119M [INFO]
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:3.0.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:3.0.1: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:3.0.1 from/to central (https://repo.maven.apache.org/maven2): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty -> [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/PluginResolutionException [ERROR] 

I can't solve this one, (my java home and path are set well).

name of java directory: java-8-oracle.

java version: java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

Solution

  • It seems like you are building the JSoup library from sources. While you can do that, you don't have to. The more standard way would be to add the library as a dependency to your own project. If you use maven, add this code to the <dependencies> section of your pom.xml:

    <dependency>
        <groupId>org.jsoup</groupId>
        <artifactId>jsoup</artifactId>
        <version>1.11.3</version>
    </dependency>