Hi Maurits,

I've achieved what you're looking for, but it wasn't easy.  If anyone
has a better solution, I'm all ears.

First of all, to do it manually, you can Right-click any project in
Eclipse and Export it to a JAR file - which can then be saved in your
GAE lib/ folder.  But, this has to be done each time you make a
change.

I'm currently using Maven in Eclipse to manage and build my projects
(this copies those external JAR files each time) and then the maven-
antrun-plugin to call the GAE command line scripts that run/upload my
project.  Now that it's set up, it is a single click to run/upload,
despite being dependent on several other Eclipse Projects and 3rd
Party plugins.

This website was the most helpful in setting that up:
http://twelves.blogspot.com/2009/04/google-appengine-maven-pom.html

Most notably, I did not use the maven-gae-plugin that is mentioned
frequently around the interwebs - I was never able to get it working
properly.

I've pasted the applicable bits of my Maven POM file below - that
might be helpful.  This is all based on MacOS commands, but I believe
Windows is similar.  If you choose not to use Maven, the applicable
ANT bits will still be helpful.

Good Luck!

Jake


<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
        <groupId>org.example</groupId>
        <artifactId>project</artifactId>
        <packaging>war</packaging>

        <properties>
                <gae.sdk.location>/Applications/eclipse/plugins/
com.google.appengine.eclipse.sdkbundle.1.3.0_1.3.0.v200912141120/
appengine-java-sdk-1.3.0</gae.sdk.location>
        </properties>

        <repositories>
                <repository>
                        <id>MVNSearch</id>
                        <name>MVNSearch</name>
                        <url>http://www.mvnsearch.org/maven2</url>
                </repository>
                <repository>
                        <id>DataNucleus</id>
                        <url>http://www.datanucleus.org/downloads/maven2/</url>
                </repository>
        </repositories>

        <dependencies>
                <dependency>
                        <groupId>com.google.appengine</groupId>
                        <artifactId>appengine-api-1.0-labs</artifactId>
                        <version>1.3.0</version>
                </dependency>
                <dependency>
                        <groupId>com.google.appengine.orm</groupId>
                        <artifactId>datanucleus-appengine</artifactId>
                        <version>1.0.4.1</version>
                        <exclusions>
                                <exclusion>
                                        
<artifactId>datanucleus-core</artifactId>
                                        <groupId>org.datanucleus</groupId>
                                </exclusion>
                        </exclusions>
                </dependency>
                <dependency>
                        <groupId>org.datanucleus</groupId>
                        <artifactId>datanucleus-core</artifactId>
                        <version>1.1.6</version>
                </dependency>
                <dependency>
                        <groupId>org.datanucleus</groupId>
                        <artifactId>datanucleus-jpa</artifactId>
                        <version>1.1.5</version>
                </dependency>
                <dependency>
                        <groupId>org.example</groupId>
                        <artifactId>otherproject</artifactId>
                        <version>0.0.1-SNAPSHOT</version>
                </dependency>
        </dependencies>

        <build>
                <finalName>${project.artifactId}</finalName>
                <resources>
                        <resource>
                                <filtering>false</filtering>
                                <directory>src/main/resources</directory>
                        </resource>
                        <resource>
                                <filtering>false</filtering>
                                <directory>src/main/java</directory>
                                <includes>
                                        <include>**</include>
                                </includes>
                                <excludes>
                                        <exclude>**/*.java</exclude>
                                </excludes>
                        </resource>
                        <resource>
                                <directory>src/main/webapp/</directory>
                                <includes>
                                        <include>**/*.xml</include>
                                </includes>
                        </resource>
                </resources>
                <plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-war-plugin</artifactId>
                                <configuration>
                                        
<warSourceDirectory>${basedir}/src/main/webapp</
warSourceDirectory>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.datanucleus</groupId>
                                
<artifactId>maven-datanucleus-plugin</artifactId>
                                <version>1.1.4</version>
                                <configuration>
                                        <excludes>
                                                
<exclude>org.datanucleus:datanucleus-core</exclude>
                                                
<exclude>org.datanucleus:datanucleus-jpa</exclude>
                                        </excludes>
                                        <verbose>true</verbose>
                                        <api>JPA</api>
                                        <mappingIncludes>**/*.jdo, 
**/model/**.class, **/*.class</
mappingIncludes>
                                        <enhancerName>ASM</enhancerName>
                                </configuration>
                                <executions>
                                        <execution>
                                                <id>compile</id>
                                                <phase>compile</phase>
                                                <goals>
                                                        <goal>enhance</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-antrun-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <id>Kill</id>
                                                <phase>clean</phase>
                                                <configuration>
                                                        <tasks 
if="appengine.kill">
                                                                <echo 
message="Killing previous server (if any)" />
                                                                <exec 
executable="sh">
                                                                        <arg 
value="-c" />
                                                                        <arg 
value="ps ax | grep com.google.appengine.tools.KickStart
| grep -v grep | awk '{print $1}' | xargs kill" />
                                                                </exec>
                                                        </tasks>
                                                </configuration>
                                                <goals>
                                                        <goal>run</goal>
                                                </goals>
                                        </execution>
                                        <execution>
                                                <id>Upload</id>
                                                <phase>install </phase>
                                                <configuration>
                                                        <tasks 
if="appengine.upload">
                                                                <echo 
message="Uploading to Google App Engine..." />
                                                                <java 
fork="false"
classname="com.google.appengine.tools.admin.AppCfg">
                                                                        
<sysproperty key="appengine.sdk.root" value="$
{gae.sdk.location}" />
                                                                        
<classpath>
                                                                                
<fileset dir="${gae.sdk.location}">
                                                                                
        <include name="**/*.jar" />
                                                                                
</fileset>
                                                                        
</classpath>
                                                                        <arg 
value="--passin" />
                                                                        <arg 
value="update" />
                                                                        <arg 
value="${basedir}/target/${project.artifactId}" />
                                                                </java>
                                                        </tasks>
                                                </configuration>
                                                <goals>
                                                        <goal>run</goal>
                                                </goals>
                                        </execution>
                                        <execution>
                                                <id>Start</id>
                                                <phase>install </phase>
                                                <configuration>
                                                        <tasks 
if="appengine.start">
                                                                <echo 
message="Starting Local Google Server..." />
                                                                <java 
fork="true"
classname="com.google.appengine.tools.KickStart"
                                                                        
classpath="${gae.sdk.location}/lib/appengine-tools-api.jar"
                                                                        
failonerror="true">
                                                                        <arg
value="com.google.appengine.tools.development.DevAppServerMain" />
                                                                        <arg 
value="${basedir}/target/${project.artifactId}" />
                                                                </java>
                                                        </tasks>
                                                </configuration>
                                                <goals>
                                                        <goal>run</goal>
                                                </goals>
                                        </execution>
                                        <!-- Connect to Debug in Eclipse by 
using Run->Debug->Remote Java
Application (using default properties) in Eclipse. -->
                                        <execution>
                                                <id>Debug</id>
                                                <phase>install </phase>
                                                <configuration>
                                                        <tasks 
if="appengine.debug">
                                                                <echo 
message="Starting Local Google Server with Debugging
Enabled..." />
                                                                <java 
fork="true"
classname="com.google.appengine.tools.KickStart"
                                                                        
classpath="${gae.sdk.location}/lib/appengine-tools-api.jar"
                                                                        
failonerror="false">
                                                                        <arg 
line="--jvm_flag=-Xdebug --jvm_flag=-
Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
com.google.appengine.tools.development.DevAppServerMain ${basedir}/
target/${project.artifactId}" />
                                                                </java>
                                                        </tasks>
                                                </configuration>
                                                <goals>
                                                        <goal>run</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <version>1.3</version>
                        </plugin>
                </plugins>
        </build>

</project>






On Jan 21, 4:42 am, Maurits <mvanbeuse...@themobilebrand.com> wrote:
> Hi all,
>
> I am an experienced .NET developer but new to JAVA and Eclipse. I am
> currently experimenting with JAVA and the GAE with plans to start
> making more use of the GAE since I really like what is offered (Google
> keep up the good work ;)).
>
> However I am running into a problem, I would like to build an
> application using multiple layers (currently a Presentation layer,
> Service layer, Business layer and a Data layer). My presentation layer
> is a GAE project created using the Eclipse plug-in, the other layers
> are all normal JAVA projects I created in the same workspace (so I
> have 4 separate projects). Now I managed to get everything compile
> correctly by referencing all projects with each other using the Java
> Build Path -> Projects dialog window.
>
> However when I run the application I run into the problem that the
> Presentation layer cannot find the classed from my Service layer
> project. I figured out that I need to manually copy the output classes
> from the Service (and others) layer into the WEB-INF/lib folder to get
> it working (preferably packed into a JAR file).
>
> My question is, can this be somehow automated? I read some information
> about using an ANT script to do so, but since I am a bit spoiled with
> Visual Studio (who does this automatically when I make the reference)
> I have no clue on how to start, I don't even know how to automatically
> pack the class files from the Service, Business and Data layers into a
> JAR file.
>
> Is there someone who can get me started?
>
> Many thanks,
>
> Maurits

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to