boatmeme/microsoft-translator-java-api — Issue #28: Java Versioning issue
Author: boatmeme
Created: 2011-12-08 22:40:54+00:00
State: open
Labels: Bug

Via email:

Hi Jonathan,

My name is Alex. I'm writing to you in order to make a contribution on microsoft-translator-java-api project.
I'm running Linux box and microsoft-translator-java-api has a compilation problem under Linux.
Since you didn't specify the version of java in pom file it's going to use 1.3 which is incompatible with the source code as it was done using 1.6 I guess.
So my fix is to add few lines into the pom file to specify the version of java to use.
I've attached diff file which you can use to import the changes to your project. Also you can add me as a contributor so I can commit those changes as well.

Here are those lines I've added to pom.xml:

org.apache.maven.plugins
maven-compiler-plugin
2.3.2

1.6
1.6
UTF-8

Here is compilation error I had:
$ mvn clean install -Dmaven.skip.test=true
[INFO] Compiling 7 source files to /home/user/documents/prj/opensource/microsoft-translator-java-api/target/classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

/home/user/documents/prj/opensource/microsoft-translator-java-api/src/main/java/com/memetix/mst/translate/Translate.java:[126,24] for-each loops are not supported in -source 1.3
(use -source 5 or higher to enable for-each loops)
for(String text : texts) {

And here is my software installed:
# mvn -v
Apache Maven 2.2.1 (rdebian-8)
Java version: 1.6.0_26
Java home: /usr/lib/jvm/java-6-sun-1.6.0.26/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.32-5-686" arch: "i386" Family: "unix"

Please let me know if those changes are OK and when it will be deployed to maven repo.

Thanks,
-- Alex