maven-gae-plugin & Google Eclipse plug-in

136 views
Skip to first unread message

drone

unread,
Dec 23, 2009, 6:15:32 AM12/23/09
to maven-gae-plugin
I've tried to set up maven-gae-example project with war directory in
project root, as discussed here:
http://groups.google.com/group/google-appengine-java/browse_thread/thread/ebfd891f84591432/26d10a7cc65aac01?lnk=gst&q=maven+eclipse+plugin#26d10a7cc65aac01

and recommended here (Solution 1):
http://mojo.codehaus.org/gwt-maven-plugin/user-guide/war-folder.html

However, when trying to enable GAE in Eclipse, error occurs with
following stack trace written to Eclipse log:

java.lang.NoClassDefFoundError: com/google/appengine/tools/admin/
AdminException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at
com.google.appengine.eclipse.core.sdk.AppEngineBridgeFactory.createBridge
(AppEngineBridgeFactory.java:141)
at
com.google.appengine.eclipse.core.sdk.AppEngineBridgeFactory.getAppEngineBridge
(AppEngineBridgeFactory.java:94)
at
com.google.appengine.eclipse.core.sdk.AppEngineUpdateProjectSdkCommand.computeBuildClasspathEntriesToRemove
(AppEngineUpdateProjectSdkCommand.java:81)
at com.google.gdt.eclipse.core.sdk.UpdateProjectSdkCommand.execute
(UpdateProjectSdkCommand.java:53)

So, for now this doesn't seem to be possible :(

drone

unread,
Dec 24, 2009, 5:13:08 AM12/24/09
to maven-gae-plugin
For the record: Message for this stack trace is "Failed to initialize
App Engine SDK at /home/drone/java/maven-repo/com/google/appengine"
And location doesn't change, no matter what SDK do I set up in Eclipse
config.

On Dec 23, 1:15 pm, drone <andr...@gmail.com> wrote:
> I've tried to set up maven-gae-example project with war directory in

> project root, as discussed here:http://groups.google.com/group/google-appengine-java/browse_thread/th...

Rodolfo Hansen

unread,
Dec 26, 2009, 12:37:17 PM12/26/09
to maven-ga...@googlegroups.com
Ok, let me check everything...

No one enjoys the holidays anymore; my inbox is FULL... :p
--
Rodolfo Hansen
CTO, KindleIT Software Development
Email: rha...@kindleit.net
Mobile: +1 (809) 860-6669

Hannu Leinonen

unread,
Jan 23, 2010, 3:35:30 PM1/23/10
to maven-gae-plugin
I'm trying to work around this, and it seems to be pretty close. The
only thing missing is enabling linkedResources in maven-eclipse-
plugin. After that's done, it'll certainly be possible to configure a
working project on Google Eclipse plugin (though it would include big-
ass configuration for maven-eclipse-plugin).

> Email: rhan...@kindleit.net
> Mobile: +1 (809) 860-6669

Hannu Leinonen

unread,
Jan 23, 2010, 4:49:45 PM1/23/10
to maven-gae-plugin
Using the current trunk from maven-eclipse-plugin with my patch found
at http://jira.codehaus.org/browse/MECLIPSE-402 (probably required
only for Windows) and the following configuration for maven-eclipse-
plugin you should be fine.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8-SNAPSHOT</version>
<configuration>
<buildOutputDirectory>war/WEB-INF/classes</buildOutputDirectory>
<projectnatures>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
<projectnature>com.google.gdt.eclipse.core.webAppNature</
projectnature>
<projectnature>com.google.appengine.eclipse.core.gaeNature</
projectnature>
</projectnatures>
<buildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
<buildcommand>com.google.gdt.eclipse.core.webAppProjectValidator</
buildcommand>
<buildcommand>com.google.appengine.eclipse.core.enhancerbuilder</
buildcommand>
<buildcommand>com.google.appengine.eclipse.core.projectValidator</
buildcommand>
</buildcommands>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</
classpathContainer>

<classpathContainer>com.google.appengine.eclipse.core.GAE_CONTAINER</
classpathContainer>
</classpathContainers>
<excludes>
<exclude>com.google.appengine:appengine-api-1.0-sdk</exclude>
<exclude>com.google.appengine:appengine-api-labs</exclude>
<exclude>com.google.appengine.orm:datanucleus-appengine</exclude>
<exclude>org.datanucleus:datanucleus-core</exclude>
<exclude>org.datanucleus:datanucleus-jpa</exclude>
<exclude>org.apache.geronimo.specs:geronimo-jpa_3.0_spec</exclude>
<exclude>org.apache.geronimo.specs:geronimo-jta_1.1_spec</exclude>
<exclude>javax.jdo:jdo2-api</exclude>
</excludes>
<linkedResources>
<linkedResource>
<name>war</name>
<type>2</type>
<location>${basedir}/target/${project.artifactId}-$
{project.version}</location>
</linkedResource>
</linkedResources>
</configuration>
</plugin>

I've only verified this on my Gaelyk project but this should work.


-Hannu

On Dec 23 2009, 1:15 pm, drone <andr...@gmail.com> wrote:
> I've tried to set up maven-gae-example project with war directory in

> project root, as discussed here:http://groups.google.com/group/google-appengine-java/browse_thread/th...

Rodolfo

unread,
Jan 26, 2010, 3:34:04 PM1/26/10
to maven-gae-plugin
Thanks Hannu,

Thats a very good point.

Until the eclipse plugin can align itself with maven conventions I
think thats as best as can be done.

On Jan 23, 5:49 pm, Hannu Leinonen <hlein...@gmail.com> wrote:
> Using the current trunk from maven-eclipse-plugin with my patch found

> athttp://jira.codehaus.org/browse/MECLIPSE-402(probably required

Hannu Leinonen

unread,
Jan 26, 2010, 4:10:21 PM1/26/10
to maven-ga...@googlegroups.com
Hi Rodolfo and all others too!

I did a blog post on the matter and there's a Maven archetype now
available for such a project. Too bad it has to rely on the snapshot of
maven-eclipse-plugin and because of
http://jira.codehaus.org/browse/MWAR-211 that there will be two
different versions of the datanucleus-appengine of which other has to be
removed. But I'd say it's as good as it can get for now. Check it out at:

http://hamandeggs.wordpress.com/2010/01/26/how-to-gae-eclipse-maven/


-Hannu

drone

unread,
Feb 16, 2010, 12:20:33 PM2/16/10
to maven-gae-plugin
I tried creating an example project demonstrating this approach based
on latest gwt-persistence-app example (Check it out here:
https://maven-gae-plugin.googlecode.com/svn/example/google-eclipse-plugin
)

Running project from Eclipse fails with a following exception:
Caused by: org.datanucleus.exceptions.NucleusException: Plugin
(Bundle) "org.datanucleus.store.appengine" is already registered.
Ensure you dont have multiple JAR versions of the same plugin in the
classpath. The URL "file:/home/andris/projects/maven-gae-example/
target/maven-gae-example-1.0-SNAPSHOT/WEB-INF/lib/datanucleus-
appengine-1.0.5.jar" is already registered, and you are trying to
register an identical plugin located at URL "file:/home/andris/
projects/maven-gae-example/target/maven-gae-example-1.0-SNAPSHOT/WEB-
INF/lib/datanucleus-appengine-1.0.5.final.jar."

I checked - there are indeed 2 datanucleus-appengine jars in that
directory. Apparently 1.0.5 is added because it is listed as a
dependency in pom.xml, but 1.0.5.final is added by Google Eclipse
plugin itself.. 1.0.5.final is not a valid Maven version number AFAIK,
so..
It seems that this approach still doesn't work for projects using
persistence.

On Jan 26, 11:10 pm, Hannu Leinonen <hlein...@gmail.com> wrote:
> Hi Rodolfo and all others too!
>
> I did a blog post on the matter and there's a Maven archetype now
> available for such a project. Too bad it has to rely on the snapshot of

> maven-eclipse-plugin and because ofhttp://jira.codehaus.org/browse/MWAR-211that there will be two

drone

unread,
Feb 16, 2010, 12:49:59 PM2/16/10
to maven-gae-plugin
Correction.
1.0.5.final is valid Maven version (Maven versioning has changed, it's
just that I haven't found any decent up-to-date documentation
explaining it).

Working example, using GAE SDK 1.3.1 and GWT 1.7.1 is here:
https://maven-gae-plugin.googlecode.com/svn/example/google-eclipse-plugin

I'll update documentation soon.

So, after switching to datanucleus-appengine-1.0.5.final everywhere
this approach works.

On Feb 16, 7:20 pm, drone <andr...@gmail.com> wrote:
> I tried creating an example project demonstrating this approach based

> on latest gwt-persistence-app example (Check it out here:https://maven-gae-plugin.googlecode.com/svn/example/google-eclipse-pl...


> )
>
> Running project from Eclipse fails with a following exception:
> Caused by: org.datanucleus.exceptions.NucleusException: Plugin
> (Bundle) "org.datanucleus.store.appengine" is already registered.
> Ensure you dont have multiple JAR versions of the same plugin in the
> classpath. The URL "file:/home/andris/projects/maven-gae-example/
> target/maven-gae-example-1.0-SNAPSHOT/WEB-INF/lib/datanucleus-
> appengine-1.0.5.jar" is already registered, and you are trying to
> register an identical plugin located at URL "file:/home/andris/
> projects/maven-gae-example/target/maven-gae-example-1.0-SNAPSHOT/WEB-
> INF/lib/datanucleus-appengine-1.0.5.final.jar."
>
> I checked - there are indeed 2 datanucleus-appengine jars in that
> directory. Apparently 1.0.5 is added because it is listed as a
> dependency in pom.xml, but 1.0.5.final is added by Google Eclipse
> plugin itself.. 1.0.5.final is not a valid Maven version number AFAIK,
> so..
> It seems that this approach still doesn't work for projects using
> persistence.
>
> On Jan 26, 11:10 pm, Hannu Leinonen <hlein...@gmail.com> wrote:
>
> > Hi Rodolfo and all others too!
>
> > I did a blog post on the matter and there's a Maven archetype now
> > available for such a project. Too bad it has to rely on the snapshot of

> > maven-eclipse-plugin and because ofhttp://jira.codehaus.org/browse/MWAR-211thatthere will be two

Taylor Leese

unread,
Feb 16, 2010, 4:50:30 PM2/16/10
to maven-gae-plugin
What are the main benefits of using the Google Eclipse plugin along
with the maven-gae-plugin? I'm asking because I don't see any need
(personally) at the moment to use the Google plugin.

drone

unread,
Feb 16, 2010, 6:07:07 PM2/16/10
to maven-gae-plugin
Well, you can change your code, hit refresh in hosted browser and see
your changes right away without restarting the server and recompiling
all the project (This is a specially useful for GWT code - you can't
really unit-test web app's looks and GWT takes very long time to
compile).

Hannu Leinonen

unread,
Feb 16, 2010, 6:05:40 PM2/16/10
to maven-ga...@googlegroups.com
Oh yeah, Eclipse automatically puts all the "missing" libraries there.
Since there's no Maven repository that would provide the jar with the
version number as 1.0.5.final there will be a collision.

The solution is just simply to clean (and refresh) the project in
Eclipse. The MavenCleaner Builder cleans up whatever Eclipse has put
into the directory and puts only the correct jars there. Bit tedious but
what can you do.


-Hannu

drone

unread,
Feb 16, 2010, 6:12:12 PM2/16/10
to maven-gae-plugin
As I mentioned above - this problem is solved by putting 1.0.5.final
into maven-gae-plugin repository.
I'll update all the examples, archetypes and maven-gae-plugin itself
to use this 1.0.5.final tomorrow.

On Feb 17, 1:05 am, Hannu Leinonen <hlein...@gmail.com> wrote:
> Oh yeah, Eclipse automatically puts all the "missing" libraries there.
> Since there's no Maven repository that would provide the jar with the
> version number as 1.0.5.final there will be a collision.
>
> The solution is just simply to clean (and refresh) the project in
> Eclipse. The MavenCleaner Builder cleans up whatever Eclipse has put
> into the directory and puts only the correct jars there. Bit tedious but
> what can you do.
>
> -Hannu
>
> On 16.2.2010 19:20, drone wrote:
>
>
>
> > I tried creating an example project demonstrating this approach based
> > on latest gwt-persistence-app example (Check it out here:

> >https://maven-gae-plugin.googlecode.com/svn/example/google-eclipse-pl...


> > )
>
> > Running project from Eclipse fails with a following exception:
> > Caused by: org.datanucleus.exceptions.NucleusException: Plugin
> > (Bundle) "org.datanucleus.store.appengine" is already registered.
> > Ensure you dont have multiple JAR versions of the same plugin in the
> > classpath. The URL "file:/home/andris/projects/maven-gae-example/
> > target/maven-gae-example-1.0-SNAPSHOT/WEB-INF/lib/datanucleus-
> > appengine-1.0.5.jar" is already registered, and you are trying to
> > register an identical plugin located at URL "file:/home/andris/
> > projects/maven-gae-example/target/maven-gae-example-1.0-SNAPSHOT/WEB-
> > INF/lib/datanucleus-appengine-1.0.5.final.jar."
>
> > I checked - there are indeed 2 datanucleus-appengine jars in that
> > directory. Apparently 1.0.5 is added because it is listed as a
> > dependency in pom.xml, but 1.0.5.final is added by Google Eclipse
> > plugin itself.. 1.0.5.final is not a valid Maven version number AFAIK,
> > so..
> > It seems that this approach still doesn't work for projects using
> > persistence.
>
> > On Jan 26, 11:10 pm, Hannu Leinonen <hlein...@gmail.com> wrote:
> >> Hi Rodolfo and all others too!
>
> >> I did a blog post on the matter and there's a Maven archetype now
> >> available for such a project. Too bad it has to rely on the snapshot of

> >> maven-eclipse-plugin and because ofhttp://jira.codehaus.org/browse/MWAR-211thatthere will be two

Hannu Leinonen

unread,
Feb 16, 2010, 6:12:17 PM2/16/10
to maven-ga...@googlegroups.com
Great, you've put it into your repository with that name! I'll switch my
archetype to use the 1.0.5.final version then. This might also make the
whole MavenCleaner builder unnecessary, since its main purpose was to
get rid of the duplicate jar.


-Hannu

Reply all
Reply to author
Forward
0 new messages