3

I need only two app-engine related jars (appengine-api-1.0-sdk-1.6.0.jar and appengine-api-labs-1.6.0.jar to be precise) in my WEB-INF/lib but Google Plugin for Eclipse (GPE) copies a dozen jars like the ones used for JDO, cache etc which i really dont need (to keep deployment and version controlling light). If I remove those from WEB-INF/lib the GPE keeps complaining and copies them back.

Same thing has been discussed earlier but it suggests writing an Ant task to remove those jars, which I really don't want to do (as am not using any ant build.xml in my project).

Does anyone have any better solution? I am more of Netbeans/Maven guy but need to use eclipse here for sake of simplicity and officially supported plugin. Everything is freshly installed.

kdabir
  • 9,623
  • 3
  • 43
  • 45

2 Answers2

3

The new Google Plugin for Eclipse has an option that allows you to remove the Datanucleus JARs. This removes about 5-6 JAR files. If you don't see the screen below, you should update your Google Plugin for Eclipse version:

enter image description here

Deployment is a non-issue because when you deploy, the SDK checks the hashes of the files in your local filesystem, compares these to hashes on Google servers, and only uploads files that have changed.

Ikai Lan
  • 2,210
  • 12
  • 13
0

Unfortunately IMO ant task is the only way I have found to do this. You can uncheck datanucleous jars in the plugin configuration as Ikay suggested, but

  1. it doesn't work in my fresh Eclipse Juno + 1.7.0 GAE installation
  2. I use Objectify and one of the jars is actually needed (geronimo, not sure if it removes it though because of reason 1)
  3. it doesn't remove endpoints jar which is huge and useless for most apps on gae

So I ended up putting all runtime libs in a separate folder (can do it the other way around and maintain a list of exclusions) and writing a simple script:

<target name="pre-deploy">
    <delete dir="deploy" />
    <mkdir dir="deploy" />
    <copy todir="deploy">
        <fileset dir="war"/>
    </copy>
    <delete>
        <fileset dir="deploy/WEB-INF/lib/" includes="*.jar"/>
    </delete>
    <copy todir="deploy/WEB-INF/lib">
        <fileset dir="lib/runtime"/>
    </copy>
    <!-- pack all classes into single jar for faster gae instance startup -->
    <jar destfile="deploy/WEB-INF/lib/myjar.jar" basedir="deploy/WEB-INF/classes" />
    <!-- delete classes (but not properties!) -->
    <delete dir="deploy/WEB-INF/classes/com" />
</target>

It is also usefull as allows to pack all classes into single jar which many have reported saves startup time. Deployment script is straightforward:

<import file="${gae.sdk}/config/user/ant-macros.xml" />

<target name="deploy" depends="pre-deploy">
    <appcfg action="update" war="war" />
</target>
Megas
  • 73
  • 5