question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Specify MAVEN_OPTS

See original GitHub issue

Hi All,

How do we specify maven command line arguments or have maven read MAVEN_OPTS env variable inside VSCode?

We have a custom nexus server that is a mirror of maven central repository setup in our settings.xml file. When opening our java project in VSCode hundreds of problems are reported stating: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact X from/to Nexus (URL) PKIX path building failed: … unable to find valid certification path for request target.

NOTE: When we remove our settings.xml file and Maven central is used, everything downloads properly except some proprietary jars we need which are not in maven central.

We have added the certificate to the Java cacerts file. We also have MAVEN_OPTS environmental variable which specifies a truststore with the proper certificates.

PS C:\workspace\Apps> $Env:MAVEN_OPTS -Djavax.net.ssl.trustStore=C:\Users\mashl\.m2\maven-trust.jks -Djavax.net.ssl.trustStorePassword=maven

Everything builds 100% successful and all jars are downloaded from our NEXUS server from the command line.

PS C:\workspace\806Apps> mvn clean install -P all-projects-dev ... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] dependencies ................................... SUCCESS [ 0.249 s] [INFO] JavaTypeScriptModels ............................... SUCCESS [ 2.867 s] [INFO] Common Utilities and Components SUCCESS [ 7.600 s] [INFO] Core ................................. SUCCESS [ 8.633 s] [INFO] Apps ............................................ SUCCESS [ 0.017 s] [INFO] WebApp .................................. SUCCESS [02:21 min] [INFO] p4lcore ............................................ SUCCESS [ 6.371 s] [INFO] Services ........................................ SUCCESS [ 4.537 s] [INFO] Task Scheduler ................................. SUCCESS [ 45.468 s] [INFO] Web Services ................................... SUCCESS [ 9.780 s] [INFO] IRWeb ...................................... SUCCESS [ 34.051 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 04:21 min [INFO] Finished at: 2018-03-01T15:11:16-06:00 [INFO] Final Memory: 193M/1535M [INFO] ------------------------------------------------------------------------ PS C:\workspace\806Apps>

Environment
  • Operating System: Windows 10
  • JDK version: 1.8.0_162 (C:\Program Files\Java\jdk1.8.0_162)
  • Visual Studio Code version: 1.20.1
  • Java extension version: 0.20.0
Steps To Reproduce
  1. Open Java project folder in VSCode
  2. Have C:\Users\mashl.m2\settings.xml specify the mirror to our repository.

[attach a sample project reproducing the error] attach logs

Current Result
Expected Result
Additional Informations

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:4
  • Comments:34 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
fbriconcommented, Jan 29, 2020

@tsmaeder now that @snjeza has more info to investigate, if she can find a fix, we’ll apply it ASAP

1reaction
jaschenkcommented, Aug 21, 2018

No matter what is specify the Build Agent does not taken in account any MAVEN_OPTS overrides and using [debug]MAVEN_OPTS is now set to -Xmx1024m for whatever reason and unable to find where this is being set on the VSTS Agent. Very frustrating. I guess I can edit the mvn script, but you shouldn’t have to do that!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring Apache Maven
MAVEN_OPTS environment variable: This variable contains parameters used to start up the JVM running Maven and can be used to supply additional options...
Read more >
Setting Java heap space under Maven 2 on Windows
To set MAVEN_OPTS under Windows 7: Right click on My Computer and select Properties (keyboard shortcut press Windows + Pause/Break ); Click the...
Read more >
MAVEN_OPTS : How to increase JVM memory
MAVEN_OPTS is an environment variable. It defines options for the JVM that executes Maven. We can set/increase JVM memory with this variable ...
Read more >
Set up Maven settings - JBoss.org
Install and configure Maven. You need to add a system environment variable MAVEN_OPTS (it could be in a .profile startup script on Linux/MacOS...
Read more >
Faster Maven builds with MAVEN_OPTS | by John Freeman
MAVEN_OPTS is an environment variable used by the shell scripts that launch the Java Virtual Machine (JVM) that runs Maven.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found