A little while ago, I upgraded my machine at work to JDK7. Everything seemed to be working fine until I needed to download a new artifact from our local Artifactory repository. I kept getting messages that my connection was timing out. After some investigation I figured out that JDK7 tries to use IPv6 by default and something on our local network didn't like that. I found a System property, java.net.preferIPv4Stack
that tells Java to try IPv4 first. I setup an environment variable
MAVEN_OPTS=-Djava.net.preferIPv4Stack=trueand everything seemed to work fine.
That is until yesterday when I tried to add a new dependency to a Leiningen project. Apparently, Leiningen doesn't utilize the MAVEN_OPTS
variable. Instead, it uses
JAVA_OPTS=-Djava.net.preferIPv4Stack=trueNow everything is working again and life is good!.
You can also put java opts in your Leiningen project.clj:
ReplyDelete:jvm-opts ["-Djava.net.preferIPv4Stack=true"]
That's interesting, thanks! But, how does that work? Isn't the jvm already running when project.clj is read?
ReplyDelete