Itâs included with JAXB, which is included by default in Java 6 and above. It has some limitations, but is sufficient for many needs.
Itâs unfortunately the first public API within the JDK/JRE that exposes a Base64 encoding mechanism, as earlier JDKs have more than one embedded Base64 encoder class, but all are internal classes.
There have been many discussions over the years as to the âbestâ way to deal with Base64 encoding, one good thread is the stackoverflow one below:
If Gradle decided to be Java 6+ only, then it could utilize this method. Otherwise it would need to utilize some JRE internal class for pre-Java 6 JDKs, or implement a simple Base64 encoder (fairly tiny code) to include within the wrapper â suppose it could include some other implementation in the wrapper jar like guava or apache commons, but size might be the concern.
My company are starting to role out gradle and require this functionality to use the gradle wrapper. As all dependencies must be sourced from our artifactory repository, which is password protected.
Iâd go with http://www.source-code.biz/base64coder/java/ (unless itâs not suitable for some reason) because itâs a lot smaller. Maybe you could also bring over the JUnit test.
I would appreciate any feedback on this, as it is my first contribution. I have emailed the signed CLA.
I added the iharder code and test as sugested. The only changes were to pass checkstyle.
I added support for specifying the username and password in the users gradle.properties file. This is because the url is normally specified in the wrapperâs property file which is committed to source control (so users adding their username and password is not always safe).
Given that Gradle 2.0 now longer support JDK 1.5 has this issues been addressed.
I have recently run into an issue with a client where only internal authenticated repositories can be used. Serving up the gradle distribution from there fails, as user/pass is not supported in the wrapper.
(Well, techinically user/pass is supported in the wrapper, but only when using a proxy - going direcly to a server requiring authentication fails).