As mentioned in the post this issues it no related to my PCs connection or anything of the sorts. I would not post in the forums if that was the case. The post you linked to should only prove this.
Of course I thought the same thing at first but I wrote a simple java program before making this post to disprove this. This is the code:
import java.net.InetAddress;
import java.net.UnknownHostException;
public class connectiontest {
public static void main(String[] args) throws UnknownHostException {
InetAddress address = InetAddress.getByName("piston-meta.mojang.com");
System.out.println(address.getHostAddress());
}
}
Which, as expected, outputs an IP address (13.107.246.64). This program ran in the same jvm, parallel to gradle which was throwing the same errors are before. To me this shows that the issue lies with ForgeGradle rather than java or my system configuration.
EDIT: After some more extensive testing I could also consistently show that the first time I ran my program after a gradle build It would result in an error:
Exception in thread "main" java.net.UnknownHostException: piston-meta.mojang.com: Name or service not known
at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:52)
at java.base/java.net.InetAddress$PlatformResolver.lookupByName(InetAddress.java:1059)
at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1668)
at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:1003)
at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1658)
at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1524)
at java.base/java.net.InetAddress.getByName(InetAddress.java:1413)
at connectiontest.main(connectiontest.java:5)
However this is solely limited to the first run, and would never occur again even after running it dozens of times. This only proves that the culprit must be ForgeGradle. To investigate this further I will attempt and look at the dns resolutions in detail using a network logger next, but this might take some time.