English 中文(简体)
SSL Problem Downloading Resource in Maven
原标题:

I am trying to create a Confluence plugin. I have been following theses instructions.

However when I run the atlas-create-confluence-plugin command maven throws SSL errors trying to get resource from https://m2proxy.atlassian.com/repository/public/.

alt text http://img46.imageshack.us/img46/6281/mavenssl.jpg

Do I need to change a setting in my configuration?

System setup: Windows Vista, with Apache Maven 2.1.0 (r755702; 2009-03-18 19:10:27+0000)

最佳回答

Accessing a repository over SSL is not really a Maven issue (which uses HttpClient under the hood and at the end classes from the java.net package), this is a pure Java issue: the certificate of the remote repository has to be trusted i.e. the CA root certificate for this certificate has to be in the cacerts file bundled in the JRE or you need to establish a chain of trust manually.

In the particular case of https://m2proxy.atlassian.com/, the certificate has been issued by DigiCert CA.

The odd part is that recent JDKs (Java 5u15 or later or Java 6u5 or later, see Bug ID:6647251) have a CA root certificate for DigiCert. So, with a recent JDK, things should just work (unless you have a proxy doing some black magic like in this issue).

If you are using an older JDK and can t upgrade, export the certificate from your browser, use keytool to add it to a trust store and setup Java to use this trust store (using the javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword system properties). See the Maven mini guide and/or this blog post for more details on how to do this.

But the easiest way would be to use a recent JDK.

问题回答

OK this looks like I got the question wrong.

For some reason maven was not downloading the maven-confluence-plugin-3.0.5.jar file. I had to manually download this file from the URL and add it in the correct location .m2 directory.

After that the whole process worked fine.

In most cases, Pascal s answer is the way to go. However, if you re building Maven itself, it doesn t work (as of Maven 3.2.3, at least), because ant fails to pass the necessary javax.net properties when it calls the MavenCli class to let Maven build the remainder of Maven.

The solution to this problem is to modify the build.xml file in the root of the maven source directory, and add these lines to the maven-compile target:

<arg value="-Djavax.net.ssl.trustStore=/path/to/trustStore" />
<arg value="-Djavax.net.ssl.trustStorePassword=TrustStorePassword" />

in windows doing the following helped with command line execution

SET MAVEN_OPTS=-Djavax.net.ssl.trustStore="C:Program FilesJavajdk1.8.0_201
jrelibsecuritycacerts"

the error I got was as follows Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

(one could also adjust mvn.cmd...) hope this hepls





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签