Wednesday, March 30, 2011

Gradle Init script vs Build script

On 7/07/10 7:06 AM, Rene Groeschke wrote:
> hi there,
> I would like to apply the eclipse plugin on demand via init script
> while updating my eclipse classpath.
> Is there a way to get this working and avoid the UnsupportedOperation
> exception I got while trying " apply plugin'eclipse' " ?

Init scripts delegate to a Gradle instance, rather than a Project
instance as the build scripts do. And so, when you do apply plugin:
'eclipse', you're trying to apply a plugin designed to work with a
Project instance, to a Gradle instance. Of course, the error message
should tell you this (and what to do about it, too, I guess).

At the moment, it's a bit awkward to apply a project plugin from an init
script. You could do something like:

addListener(new ApplyPluginListener())

class ApplyPluginListener extends BuildAdapter {
public void projectsEvaluated(Gradle gradle) {
gradle.rootProject.allprojects { apply plugin: 'eclipse' }
}
}

Ideally, the init script would offer something like an allprojects { }
method, to make this kind of thing simpler.



Tuesday, March 22, 2011

How to setup JAVA_HOME on Mac OSX


25
down voteaccepted

Does Snow Leopard still have /usr/libexec/java_home? On 10.5, I just set JAVA_HOME to the output of that command, which should give you the Java path specified in your Java preferences. Here's a snippet from my .bashrc file, which sets this variable:

export JAVA_HOME=$(/usr/libexec/java_home)

I haven't experienced any problems with that technique.

(Occasionally I do have to change the value of JAVA_HOME to an earlier version of Java. For example, one program I'm maintaining requires 32-bit Java 5 on OS X, so when using that program, I setJAVA_HOME to /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home.)

link|edit|flag
Snow Leopard does still have /usr/libexec/java_home. ThanksRobert Christie Aug 28 '09 at 20:40

I tend to use /Library/Java/Home. The way the preferences pane works this should be up to date with your preferred version.

link|edit|flag

Also, it`s interesting to set your PATH to reflect the JDK. After adding JAVA_HOME (which can be done with the example cited by 'mipadi'):

export JAVA_HOME=$(/usr/libexec/java_home)

Add also in ~/.profile:

export PATH=${JAVA_HOME}/bin:$PATH

P.S.: For OSX, I generally use .profile in the HOME dir instead of .bashrc


http://stackoverflow.com/questions/1348842/what-should-i-set-java-home-to-on-osx


Install Java 1.5 on Mac OSX

http://wiki.oneswarm.org/index.php/OS_X_10.6_Snow_Leopard
Snow Leopard Java problems (and fix)

Update: OneSwarm 0.6.7 is now available and fixes most Snow Leopard compatibility issues. Download here

The OneSwarm annonymous filesharing client version 0.6.5 does not run properly on Mac OS X 10.6 "Snow Leopard" because of compatibility issues between the 64 bit Java 6 VM and SWT, symptoms are:

  • Connections will never handshake completely because packets sent by the user running 10.6 will not reach the network interface (except the initial ~20 byte handshake packet). Probable cause: not receiving write selects (?). Workaround below
  • When double clicking on a torrent a window will pop up saying "file could not be opened".
  • In the classic ui: Preferences will not show the values of the actual preferences, clicking in the box will cause the value to be shown.

Workaround for connection problem

In the terminal:

Get the java 5 that was included in 10.5 "leopard" and unpack

cd /tmp/ ;curl -o java.1.5.0-leopard.tar.gz http://www.cs.washington.edu/homes/isdal/snow_leopard_workaround/java.1.5.0-leopard.tar.gz ;tar -xvzf java.1.5.0-leopard.tar.gz 

Move it to your System java folder (password needed)

sudo mv 1.5.0 /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard 


Tell OS X that java 5 actually is java 5

cd /System/Library/Frameworks/JavaVM.framework/Versions/ ;sudo rm 1.5.0 ;sudo ln -s 1.5.0-leopard 1.5.0 ;sudo rm 1.5 ;sudo ln -s 1.5.0 1.5 

Open Java Preferences

open "/Applications/Utilities/Java Preferences.app" 

Change the properties to use Java 5 32-bit by default: