Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] M2E Maven Launchers not consistently handling javax.net.ssl settings

Ricardo Gladwell wrote:

M2E is not consistently handling javax.net.ssl.* settings
that allow access.

It's more a matter of understanding in what JVM Maven gets executed and how this JVM gets configured.

I'm passing the following values into my eclipse.ini file:

 > -Djavax.net.ssl.trustStore=/home/user/.java/truststores/company-cacerts
 > -Djavax.net.ssl.keyStore=/home/user/Documents/user.p12
 > -Djavax.net.ssl.keyStorePassword=********
 > -Djavax.net.ssl.keyStoreType=PKCS12

When I execute Project -> Right Click -> Maven -> Update Dependencies...
M2E successfully accesses our Artifactory repository via SSL

In case of "Update Dependencies...", Maven gets invoked inside the same JVM that Eclipse runs in, hence the system properties set in eclipse.ini are effective in that case.

However, when I run a Maven run launcher, for example by selecting
Project -> Right Click -> Run As -> Maven install I get network errors
(see attached). This happens regardless of whether I use the internal
m2e maven launcher, or an external one.

I note I'm also configuring similar settings via JAVA_OPTS and MAVEN_OPTS:
[...]
Maven is building correctly when I execute "mvn install" from the
command line

"Run As..." forks a new JVM which is generally independent from any settings given in your eclipse.ini. Furthermore, the environment variable MAVEN_OPTS is only interpreted by the mvn/mvn.bat shell scripts, i.e. MAVEN_OPTS is not evaluated by any of Maven's Java code. But "Run As" doesn't invoke the mvn shell scripts, it directly calls the java executable and Maven's main() Java method. This is why the env vars don't kick in automatically.

Having that said, you should be able to reuse your MAVEN_OPTS for "Run As" by adding

  ${env_var:MAVEN_OPTS}

to the field "VM arguments" under the "JRE" tab of a Maven launch configuration. I wonder whether this would make a good default configuration that should be applied to all Maven launch configurations upon their creation.


Benjamin


Back to the top