5

I'm trying to enable TSLv1.2 in my machine which has java 1.7 using the commands -mvn -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 install / mvn -Dhttps.protocols=TLSv1.2 install. But its throwing some errors saying my pom.xml has some unresolved dependencies, those dependencies errors are there because my project couldn't download from maven repository due to TSLv1.2 issue. Seems like a deadlock to me, Can anyone help me on how to resolve it?

Charan
  • 143
  • 1
  • 3
  • 8
  • so your maven repository only talk on TLS 1.2 ? – jmj Nov 04 '18 at 00:16
  • See https://superuser.com/questions/747377/enable-tls-1-1-and-1-2-for-clients-on-java-7. And https://stackoverflow.com/questions/12525288/is-there-a-way-to-pass-jvm-args-via-command-line-to-maven. Read and understand **both** of those, and combine the solutions. – Stephen C Nov 04 '18 at 00:24
  • 1
    (By the way, this is absolutely nothing to do with "deadlock".) – Stephen C Nov 04 '18 at 00:27
  • @StephenC I'm using Win 64 bit/8Gb machine, I tried setting different combinations as MAVEN_OPTS value "-Xms800m -Xmx800m -XX:MaxPermSize=500m"/"-Xms128m -Xmx256m"/"-Xms128m -Xmx256m". All the combinations throws this error "Invalid initial heap size. Error: Couldnt create the JVM, A fatal has occured, program will exit" – Charan Nov 04 '18 at 03:32
  • @StephenC can you temme whete am i going wrong? – Charan Nov 04 '18 at 03:32
  • @StephenC I meant deadlock because i couldn't resolve ojdbc.jar dependency issue because of protocol, couldnt resolve protocol issue becuase of ojdbc.jar issue in POM.xml – Charan Nov 04 '18 at 03:33
  • That is not what the word deadlock means in IT. Deadlocks are about locking. Perhaps you meant gridlock? Or that you were stuck? – Stephen C Nov 04 '18 at 05:11
  • As to what you are actually doing wrong, I can't tell ... because your descriptions of what you are doing are imprecise. But trust me, if you **understand** what is going on and then follow the instructions properly, it >> will << work. For instance, you comment on Jigar's answer suggests that you have managed to mess up the `MAVEN_OPTS` variable in another way. – Stephen C Nov 04 '18 at 05:13
  • The other way to solve this is 1) learn how the shell script language works, 2) read the `mvn` shell script to understand what it is doing, 3) read the manual entry for `java` which explains clearly how JVM options should be passed, 4) put it all together to figure out precisely what you are doing wrong. – Stephen C Nov 04 '18 at 05:19

1 Answers1

4

You need to configure MAVEN_OPTS env variable or settings.xml to pass proper vm args to JVM (maven JVM)

For quick test, try this

set MAVEN_OPTS with -Dhttps.protocols=TLSv1.2,TLSv1.1

export MAVEN_OPTS=-Dhttps.protocols=TLSv1.2,TLSv1.1

(export is for unix based system, for windows see here)

and re-run your maven command

read more on maven's configuration

jmj
  • 237,923
  • 42
  • 401
  • 438
  • I set the value of "set MAVEN_OPTS = -Dhttps.protocols=TLSv1.2,TLS v1.1". I tried running my maven command after that "mvn -Dhttps.protocols=TLSv1.2 install". Its still throwing "Invalid Initial Heap size error " – Charan Nov 04 '18 at 03:39
  • This is simply wrong cause the error message tells you exactly that you are doing changes in the memory configurations like `-Xmx ..` – khmarbaise Nov 04 '18 at 09:13