0

I need to pass jvm arg -Djava.net.preferIPv4Stack=true to Ant task"get". Is it possible?

    <!-- getting  submit.jar  -->
    <echo message="getting  submit.jar..." />
    <get src="http://servername/Bootstrap?artifact=submit.jar" dest="../lib/submit.jar"/>

Initial problem is Weird java.net.SocketException Permission Denied connect error when running Groovy in Intellij IDEA

Community
  • 1
  • 1
Andrei N
  • 4,716
  • 4
  • 29
  • 29

2 Answers2

3

Try setting ANT_OPTS variable. Here is an example:

export ANT_OPTS="-Djava.net.preferIPv4Stack=true"

Maven documentation (section Manual JVM options)

Sebastian Łaskawiec
  • 2,667
  • 15
  • 33
1

You can pass arguments to ant by using the -D argument

Try:

ant -Djava.net.preferIPv4Stack=true get

unless a new jvm is launched while executing target get, your arguments will apply to commands executed for that target as well

Attila
  • 28,265
  • 3
  • 46
  • 55
  • I get java.net.SocketException: Permission denied: connect, when argument doesn't be applied – Andrei N Jun 13 '12 at 13:05
  • @skydreamerr - can update your question with (at least the relevant portions of) the build.xml? Also, do you have the same exception when calling without the parameter specified. Also, plese post the whole stack trace for the exception – Attila Jun 13 '12 at 13:10
  • @skydreamerr - please rephrase that. It does not make sense. – Stephen C Jun 13 '12 at 13:10
  • I've attached initial problem – Andrei N Jun 13 '12 at 13:20
  • @skydreamerr - it seems like the Windows firewall might be [the problem](http://stackoverflow.com/questions/10473518/workaround-for-apache-ant-install-bug/10473581#10473581). The link provides a solution for ftp trafic, but you could try disabling the firewall altogether while you are running the get target. If that helps, you will need to find the right protocol to disable filtering for in the firewall, so you are not completely unprotected – Attila Jun 13 '12 at 13:37
  • I use VPN, that doesn't support ipv6 – Andrei N Jun 13 '12 at 13:40