GRADLE: How to specify resources from different folders on your sourceSet

Sometimes you need to have resources in your sourceset and these may come from different locations on disk, the official documentation is lacking in real world examples, or at least I just didn’t understand it very well, but from reading forums I finally got it to work.

In the example I specify what files to include/exclude from two different folders.
When the final .jar is created, they’ll keep the package path structure that lives inside the given srcDir folders.

If you just want to add these files (for some reason to the root of your resulting jar, you should make srcDir the full path to where the files live)

[pastacode lang=”java” manual=”sourceSets%20%7B%0Amain%20%7B%0Ajava%20%7B%0A%2F%2Fyour%20java%20source%20paths%20and%20exclusions%20go%20here%E2%80%A6%0A%7D%0A%0Aresources%20%7B%0AsrcDir%20%E2%80%98components%2Fresources%2Fsrc%2Fmain%2Fresources%E2%80%99%0Ainclude%20%E2%80%98**%2F*.properties%E2%80%99%0Ainclude%20%E2%80%98**%2F*.png%E2%80%99%0Ainclude%20%E2%80%98**%2F*.gif%E2%80%99%0Ainclude%20%E2%80%98**%2F*.jpg%E2%80%99%0Ainclude%20%E2%80%98**%2F*.html%E2%80%99%0Ainclude%20%E2%80%98**%2F*.js%E2%80%99%0Ainclude%20%E2%80%98**%2F*.sh%E2%80%99%0Ainclude%20%E2%80%98**%2F*.dat%E2%80%99%0Ainclude%20%E2%80%98**%2F*.icc%E2%80%99%0Aexclude%20%E2%80%98**%2F*.DS_Store%E2%80%99%0A%0AsrcDir%20%E2%80%98common%2Fvuze%2Fazureus2%2Fsrc%E2%80%99%0Ainclude%20%E2%80%98**%2FMessages*.properties%E2%80%99%0Aexclude%20%E2%80%98**%2F*.class%E2%80%99%0Aexclude%20%E2%80%98**%2F*.java%E2%80%99%0A%7D%0A%7D%0A%7D” message=”” highlight=”” provider=”manual”/]

GRADLE: How to copy files from another .jar into your resulting output .jar

In our project we like to deliver a single jar as the final product, if you need to copy files that live on an existing jar into the Gradle’s output jar, this example shows you how to do that (and more)

[pastacode lang=”java” manual=”jar%20%7B%0A%2F%2Fthis%20is%20how%20you%20change%20the%20name%20of%20the%20output%20jar%0AarchiveName%3D%E2%80%99frostwire.jar%E2%80%99%0A%0A%2F%2Fsome%20exclusion%20rules%20to%20keep%20your%20.jar%20clean%0Aexclude(%E2%80%98META-INF%2F*.SF%E2%80%99%2C%20%E2%80%98META-INF%2F*.DSA%E2%80%99%2C%20%E2%80%98META-INF%2F*.RSA%E2%80%99%2C%20%E2%80%98META-INF%2F*.MF%E2%80%99)%0A%0A%2F%2Fhere%20we%20grab%20all%20the%20.class%20files%20inside%20messages.jar%20and%20we%20put%20them%20in%20our%20resulting%20jar%0Afrom%20(zipTree(%E2%80%98lib%2Fjars%2Fmessages.jar%E2%80%99))%20%7B%0Ainclude%20%E2%80%98**%2F*.class%E2%80%99%0A%7D%0A%0A%2F%2Fhow%20to%20manipulate%20the%20jar%E2%80%99s%20manifest%0Amanifest%20%7B%0Aattributes%20%E2%80%98Main-Class%E2%80%99%3A%20%E2%80%98com.limegroup.gnutella.gui.Main%E2%80%99%0A%7D%0A%7D” message=”” highlight=”” provider=”manual”/]

GRADLE: How to add a list of local .jar files to the build classpath

Sometimes you don’t want/cant use maven repos, all you have is a bunch of local jars on disk that you want to use as part of your compilation classpath, and the freaking gradle documentation is too vague.

Here is an example:

[pastacode lang=”java” manual=”dependencies%20%7B%0Acompile%20files(%E2%80%98lib%2Fjars%2Fgettext-commons.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjars%2Flucene-3.5.0.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjaudiotagger.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjars%2Fh2-1.3.164.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjars%2Fmessages.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjars%2Fslf4j-api-1.7.5.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjars%2Fjaudiotagger.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjars%2Fmetadata-extractor-2.6.2.jar%E2%80%99%0A)%0A%7D” message=”” highlight=”” provider=”manual”/]

[SOLVED] Gradle: How to increase the Java Compiler’s available Heap Memory

The documentation is not very clear on what all the available options are…
after much Googling and many different attempts finally figured out how to raise the maximum heap of the compiler from within the script.

[pastacode lang=”java” manual=”apply%20plugin%3A%20%E2%80%98java%E2%80%99%0A%0AcompileJava%20%7B%0A%2F%2Fraise%20heap%0Aoptions.fork%20%3D%20%E2%80%98true%E2%80%99%0Aoptions.forkOptions.with%20%7B%0AmemoryMaximumSize%20%3D%20%E2%80%9C2048m%E2%80%9D%0A%7D%0A%7D” message=”” highlight=”” provider=”manual”/]

So I’ve noticed this works great on MacOSX, but it doesn’t work at all on Windows 8.

The solution to increasing the JVM’s Heap has been to remove those options from script and add a new file on the same folder as where your file lives called ‘’

These are the contents that made it work for both Mac and Windows (I’ve still not tested this on my linux box)

[pastacode lang=”java” manual=”org.gradle.jvmargs%3D-Xms256m%20-Xmx1024m” message=”” highlight=”” provider=”manual”/]

[SOLVED] Sublime Text 2: Git binary could not be found in PATH

Got this annoying dialog popping up on Sublime Text 2?
Screen Shot 2014-07-22 at 4.31.03 PM

Go to Preferences > Browse Packages …

Screen Shot 2014-07-22 at 4.33.02 PM

a Finder window will open, go to the “Git” folder, open the file called “Git.sublime-settings”

Look for “git_command” and set it’s value to the path of your git executable

Screen Shot 2014-07-22 at 4.31.47 PM

(you can find the path of your git executable on the Terminal by typing “which git”)

Screen Shot 2014-07-22 at 4.35.24 PM

Is there an Android manufacturer for intelligent adults?

I wish there were an Android phone in the market that:

– Let’s me have Admin privileges on my device out of the box (rooted by default)

– Does not start 20+ background processes I don’t want along with a lot of uninstallable apps that just eat on my resources and battery life.

for example:

what the fuck is “Samsung Watch ON”, “PageBuddyNotiSvc”, “Knox Notification Manager”, “Touch Wiz Home”, “Isis Wallet” (I only want my Bitcoin wallet and I can’t uninstall this shit) , Samsung Health crap (I already have my fitness apps, I’d love to uninstall your shit Samsung), Fucking “Lookout” (I don’t want this), Samsung Text-to-speech engine (it sucks, I don’t want it eating my resources), Samsung Push Service (I’ll never use that shit, let me uninstall it), KLMS Agent, Samsung Apps, AT&T Locker… etc. etc. I don’t want any of this shit, I bet my battery life would greatly be improved if none of this crap was running in my phone.

Let’s developers develop. And this one goes to Google (and Apple too), how are we supposed to make a change if you keep blocking access to non-OEM developers from accesing even basic things like SD Card storage, it’s a very dickhead move what Google did to developers accessing the SD Card after their KitKat update, now you can only write to a certain sandboxed folder (ignoring the fact users had already given us permission to write on the SD Card) and when your app is uninstalled files are deleted, also, files can’t be scanned by their multimedia scanner if they are on those folders, so if you have created an app that works with Video/Music you have to pretty much hack around and waste time dealing with their bullshit instead of focusing on making your app better.