Maven. Lambda Expressions Are Not Supported in -Source 1.5

Maven can't find a compiler on Linux

This means you don't have installed a JDK...so you need to install one to get Maven working.

Maven build error in Jenkins (Semi time sensitive)

I have the same problem today.
The latest version of com.google.http-client is 1.22.0 which definitely falls into the range [1.19.0,2.0).

Not sure what's causing the resolution error but here is a hacky work around.

Find appengine-gcs-client-0.6.pom in your local maven repo.

e.g. Mine is under $HOME/.m2/repository/com/google/appengine/tools/appengine-gcs-client/0.6/appengine-gcs-client-0.6.pom.

Change the version range to the latest version.

<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<!-- <version>[1.19.0,2.0)</version> -->
<version>1.22.0</version>
</dependency>

I'll update the answer once I figure out a real solution.

Update:
I think the cause of the issue is that http://central.maven.org/maven2/com/google/http-client/google-http-client/maven-metadata.xml has outdated content.

<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<versioning>
<latest>1.5.3-beta</latest>
<release>1.5.3-beta</release>
<versions>
<version>1.5.0-beta</version>
<version>1.5.3-beta</version>
</versions>
<lastUpdated>20111021163718</lastUpdated>
</versioning>
</metadata>

You can also update your pom.xml to exclude the offending transitive dependency and add it explicitly.

<!-- mapreduce -->
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-mapreduce</artifactId>
<version>0.8.5</version>
<exclusions>
<exclusion>
<!-- TODO remove me after the issue is fixed https://github.com/google/google-http-java-client/issues/330 -->
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>0.6</version>
<exclusions>
<exclusion>
<!-- TODO remove me after the issue is fixed https://github.com/google/google-http-java-client/issues/330 -->
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Add the transitive dependency explicity -->
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.22.0</version>
</dependency>

IntelliJ Project level changed:

The problem was solved by using jdk8 with lambda support which is available as a separate download.

Can I use Java 8 with Android Development now?

If you've been using Java 7 to deploy Android apps then it's certain, up to this point, you haven't used any Java 8 features so I don't see how it would matter.

Follow your instructor's directions and when you do an assignment for school simply select either the JDK or Language Level in the Project Structure.

CTRL + ALT + S, select Project

You can default to the Java 8 SDK but limit it to Java 7's features for your Android apps. Or you can simply set your homework projects to the Java 8 SDK.

Going out on a limb here assuming Android Studio includes the core settings of Intellij.

IntelliJ & MAC and Java 1.8 -- How when 1.6 seems to be default. Can't change?

You need to install the full Java SE Development Kit.

What you have at the moment is merely the Java plugin.

Android Studio refactor revert all lambdas and other Java 8 features

You can replace the lambda by placing the cursor inside the -> and pressing Alt + Enter then select "Replace lambda with..."

Sample Image


You can do it on an entire file by expanding the menu and selecting "Fix all..."

Sample Image


You can do it on the whole project by following the above steps, but instead click "Run inspection on..."

Sample Image

Select "Whole project"

Sample Image

Once the inspection finishes, right click on the "Lambda can be replaced..." section and select "Replace lambda with..."

Sample Image



Related Topics



Leave a reply



Submit