18

I have installed Eclipse Luna 4.4-M6. I tried installing the Google Plugin for Eclipse 4.3 (Kepler), but Eclipse would not allow me to install it.

Is there some way to force it to install (e.g. by downloading it and editing some manifest or other)? Or would this be futile due to breaking changes between 4.3 and 4.4?

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
ᴇʟᴇvᴀтᴇ
  • 12,285
  • 4
  • 43
  • 66
  • Luna is still in development (M6 is a Milestone build) so other products are not likely to have tested with it yet. – greg-449 Apr 17 '14 at 06:56
  • 1
    I understand that Luna is still in development. I was wondering if there's some way to install the plugin anyway. I'm prepared to take that risk. – ᴇʟᴇvᴀтᴇ Apr 18 '14 at 10:00
  • 1
    Luna is officially released now so now we wait on google! – Gunnar Eketrapp Jun 27 '14 at 12:58
  • possible duplicate of [Cannot install Google Plugin in Eclipse 4.4](http://stackoverflow.com/questions/22031881/cannot-install-google-plugin-in-eclipse-4-4) – Bob Jul 02 '14 at 16:05
  • current solution: http://stackoverflow.com/questions/25333657/is-there-a-gradle-plugin-for-eclipse-luna/25969988#25969988 – Behnam Oct 08 '14 at 10:55

4 Answers4

7

According to the Google Plugin for Eclipse community forum, we might be able to expect a new plugin with Luna support by mid-July.

https://groups.google.com/forum/#!topic/google-plugin-eclipse/4YACQROrB2U

Jim McCabe
  • 116
  • 1
  • 3
  • Thanks for pointing out this group. I've managed to install the Kepler plugin in Luna using instructions provided in that discussion thread. I've upvoted you, but marked my answer as the accepted answer as it offers a way to solve the problem that doesn't involve waiting... :-) – ᴇʟᴇvᴀтᴇ Jul 21 '14 at 19:48
  • It's finally arrived! – ᴇʟᴇvᴀтᴇ Aug 01 '14 at 19:38
2

It turns out there is a way to alter the manifests to allow the Google Plugin for Kepler to install in Eclipse Luna. Contributor Ze Kritter on Google Groups has written an Apache Ant build.xml file that performs the necessary work, original here and reproduced below.

It worked beautifully for me. I have successfully run this script and installed the plugin into Luna, and - at least for GWT - it seems to work as usual.

According to the discussion thread on Google Groups there are some incompatibilities with the Maven plugin (I personally don't use Maven) and a new and suitably well-tested Google plugin will be coming out shortly (late July 2014).

<?xml version="1.0" encoding="UTF-8"?>

<project name="gpe.4.luna" basedir="." default="update.end">
    <property environment="env"/>

    <property name="project.base.dir" value="."/>
    <property name="project.temp.dir" value="${project.base.dir}/temp"/>
    <property name="project.plugin.dir" value="${project.base.dir}/plugin"/>
    <property name="project.plugins.dir" value="${project.plugin.dir}/plugins"/>
    <property name="e42.plugin.jar" value="${project.plugins.dir}/com.google.gdt.eclipse.platform.e42_3.6.0.v201406262229-rel-r43.jar"/>
    <property name="artifacts.jar" value="${project.plugin.dir}/artifacts.jar"/>
    <property name="content.jar" value="${project.plugin.dir}/content.jar"/>

    <property name="plugin43.zip" value="com.google.gdt.eclipse.suite.4.3.update.site_3.6.0.zip"/>
    <property name="plugin44.zip" value="com.google.gdt.eclipse.suite.4.4.update.site_3.6.0.zip"/>

    <!--
        source: http://stackoverflow.com/a/5340557/3747097
        Loads entries from a manifest file.

        @jar     The jar from where to read
        @file    A manifest file to read
        @prefix  A prefix to prepend
        @section The name of the manifest section to load
    -->
    <scriptdef name="loadManifest" language="javascript" loaderRef="sharedbuild-loaderRef">
        <attribute name="jar" />
        <attribute name="file" />
        <attribute name="prefix" />
        <attribute name="section" />
        <![CDATA[
            var jarname = attributes.get("jar");
            var filename = attributes.get("file");
            if (jarname != null && filename != null) {
                self.fail("Only one of jar or file is required");
            }
            var prefix = attributes.get("prefix");
            if (prefix == null) {
                prefix = "";
            }
            var section = attributes.get("section");

            var manifest;
            if (jarname != null) {
                var jarfile = new java.util.jar.JarFile(new java.io.File(jarname));
                manifest = jarfile.getManifest();
            } else if (filename != null) {
                manifest = new java.util.jar.Manifest(new java.io.FileInputStream(new java.io.File(filename)));
            } else {
                self.fail("One of jar or file is required");
            }

            if (manifest == null) {
                self.log("No manifest in " + jar);
            } else {
                var attributes = (section == null) ? manifest.getMainAttributes() : manifest.getAttributes(section);
                if (attributes != null) {
                    var iter = attributes.entrySet().iterator();
                    while (iter.hasNext()) {
                        var entry = iter.next();
                        // self.log("key " + entry.getKey());
                        // self.log("value " + entry.getValue());
                        project.setProperty(prefix + entry.getKey(), entry.getValue());
                    }
                }
            }
        ]]>
    </scriptdef>

    <!--
        source: http://giorgio-ferrara.blogspot.ru/2010/09/apache-ant-how-to-search-and-replace.html
    -->
    <macrodef name="replaceStringWithRegExp">
        <attribute name="string"/>
        <attribute name="searchPattern"/>
        <attribute name="replacementPattern"/>
        <attribute name="property"/>
        <sequential>
            <tokens id="id">
                <concat>
                <string value="@{string}"/>
                <filterchain>
                    <tokenfilter>
                        <replaceregex pattern="@{searchPattern}"
                                    replace="@{replacementPattern}"
                                    flags="g"/>
                    </tokenfilter>
                </filterchain>
                </concat>
            </tokens>
            <property name="@{property}" value="${toString:id}"/>
        </sequential>
    </macrodef>

    <target name="clean">
        <delete dir="${project.temp.dir}"/>
        <delete dir="${project.plugin.dir}"/>
        <delete file="${plugin44.zip}"/>
    </target>

    <target depends="clean" name="init">
        <mkdir dir="${project.temp.dir}"/>
    </target>

    <target depends="init" name="check.source">
        <condition property="plugin-not-found">
            <not>
                <available file="${plugin43.zip}"/>
            </not>
        </condition>
    </target>

    <target depends="check.source" name="get.source" if="${plugin-not-found}">
        <get src="https://commondatastorage.googleapis.com/eclipse_toolreleases/products/gpe/release/3.6.0/4.3/com.google.gdt.eclipse.suite.4.3.update.site_3.6.0.zip" dest="."/>
    </target>

    <target depends="check.source, get.source" name="unzip.source">
        <unzip src="${plugin43.zip}" dest="${project.plugin.dir}"/>
    </target>

    <target depends="unzip.source" name="update.manifest">
        <checksum file="${e42.plugin.jar}" property="original.md5"/>
        <loadManifest jar="${e42.plugin.jar}" prefix="e42.mf."/>
        <replaceStringWithRegExp string="${e42.mf.Require-Bundle}"
            searchPattern="(.*);bundle-version=&quot;\[3.8.0,3.10.0\)&quot;(.*)"
            replacementPattern="\1\2"
            property="Require-Bundle"/>
        <!--
        <echo>${e42.mf.Require-Bundle}</echo>
        <echo>${Require-Bundle}</echo>
        -->
        <jar update="true" file="${e42.plugin.jar}">
            <manifest>
                <attribute name="Require-Bundle" value="${Require-Bundle}"/>
            </manifest>
        </jar>
        <checksum file="${e42.plugin.jar}" property="updated.md5"/>
        <!--
        <echo>${original.md5}</echo>
        <echo>${updated.md5}</echo>
        -->
    </target>

    <target depends="update.manifest" name="update.artifacts">
        <delete includeemptydirs="true">
            <fileset dir="${project.temp.dir}" includes="**/*"/>
        </delete>
        <unzip src="${artifacts.jar}" dest="${project.temp.dir}"/>
        <replaceregexp byline="true">
            <regexp pattern="${original.md5}"/>
            <substitution expression="${updated.md5}"/>
            <fileset dir="${project.temp.dir}"/>
        </replaceregexp>
        <zip destfile="${artifacts.jar}" basedir="${project.temp.dir}"/>
    </target>

    <target depends="update.artifacts" name="update.content">
        <delete includeemptydirs="true">
            <fileset dir="${project.temp.dir}" includes="**/*"/>
        </delete>
        <unzip src="${content.jar}" dest="${project.temp.dir}"/>
        <replaceregexp byline="true">
            <regexp pattern="name='org.eclipse.core.runtime' range='\[3.8.0,3.10.0\)'"/>
            <substitution expression="name='org.eclipse.core.runtime' range='0.0.0'"/>
            <fileset dir="${project.temp.dir}"/>
        </replaceregexp>
        <zip destfile="${content.jar}" basedir="${project.temp.dir}"/>
    </target>

    <target depends="update.content" name="create.updated.plugin">
        <zip destfile="${plugin44.zip}" basedir="${project.plugin.dir}"/>
        <delete dir="${project.temp.dir}"/>
        <delete dir="${project.plugin.dir}"/>
    </target>

    <target depends="create.updated.plugin" name="update.end">
        <echo message="plugin rebuild success"/>
    </target>

</project>

I'll add the words Eclipse Mars here, so this solution can be found by searching and potentially adapted for the June 2015 release of Eclipse.

ᴇʟᴇvᴀтᴇ
  • 12,285
  • 4
  • 43
  • 66
  • 1
    The official version of GPE 3.7.0 is now live: [https://dl.google.com/eclipse/plugin/4.4](https://dl.google.com/eclipse/plugin/4.4) (Eclipse Luna) – ᴇʟᴇvᴀтᴇ Aug 01 '14 at 19:39
2

This seems to be recently resolved.

I didn't find the plugin in the Marketplace as of writing this, but there's an update site: https://dl.google.com/eclipse/plugin/4.4

You can read more about this at https://developers.google.com/eclipse/docs/install-eclipse-4.4

Henrik Paul
  • 66,919
  • 31
  • 85
  • 96
  • Yep, I actually added a comment to that effect under my answer above, but it's good to have it as a full answer and not just a comment. Thanks. – ᴇʟᴇvᴀтᴇ Aug 03 '14 at 20:32
0

Google just released its official SDK for Eclipse Luna: https://developers.google.com/eclipse/docs/getting_started

MrTux
  • 32,350
  • 30
  • 109
  • 146