Posts Tagged ‘eclipse’

Mavenizing my project

Dienstag, April 6th, 2010

I started working on a Google App Engine project the usual way: using the Eclipse plugin. However, unfortunately the update to the latest Eclipse plugin broke it and I haven’t found a fix yet. So I decided to try the maven-gae-plugin, once again; with Maven everything runs builds better anyway, right? So far I had only made some minor tests with the plugin.

Setup

For mavenizing the project I went the safe route: I created a new project with the maven archetype plugin:


mvn archetype:create\
 -DarchetypeGroupId=net.kindleit\
 -DarchetypeArtifactId=gae-archetype-gwt\
 -DarchetypeVersion=0.5.0\
 -DgroupId=your.groupId\
 -DartifactId=your-artifactId\
 -DremoteRepositories=http://maven-gae-plugin.googlecode.com/svn/repository

The project itself was only temporary, I was interested in the pom.xml file. I updated that file accordingly (e.g. the plugin version of the file was not the latest), removed GWT sections as I don’t use GWT in my project and changed some minor settings and added all required dependencies. Finally I copied the pom.xml into my project directory.

Subversion trouble

Then I made a lot of modifications within Eclipse – moved sources to standard Maven locations, removed JAR files etc. and was about to commit everything – but unfortunately Subversion detected a bunch of tree conflicts. Bummer. While resolving these conflicts seem to be hard, I decided to check out the project into another directory and start changing the structure from scratch – this time not using Eclipse but Subversion command line tools. That worked perfectly.

Running

With running mvn gae:run I started the development server. Startup was really smooth. However, by default the server is started on localhost only, but in my project I need a specific IP address as I need to access the server from the iPhone, too. Therefore I had to set the gae.address property. Of course it can be defined in pom.xml, but then it is the same for all development machines. I don’t want that. Therefore it must be defined in the users’s ~/.m2/settings.xml:


  <profiles>
    <profile>
      <id>gae</id>
      <properties>
        <gae.address>192.168.178.24</gae.address>
      </properties>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>gae</activeProfile>
  </activeProfiles>

Now the server runs on the right IP address.

Debugging

Now with using Maven I did not want to get rid of the ability to debug my application. How can this be done? Easy. First of all, the plugin provides the mvn gae:debug goal. When running this goal, the development server starts in debug mode.

In Eclipse a new run debug configuration has to be created.

  1. In the Console run mvn gae:debug; Maven will compile, execute tests and start the development server in debug mode.
  2. Wait until the server waits for the remote debugger; you will see the following output: “Listening for transport dt_socket at address: 8000″. The address is in this case the port, which needs to be set in the Eclipse debug configurations.
  3. In Eclipse go to Run > Debug Configurations …
  4. Create a new “Remote Java Application” configuration
  5. Give it a good name, choose Connection Type “Standard (Socket Attach)” and set the Connection Properties (in my case Host: 192.168.178.24, Port: 8000)
  6. Click on “Debug”. Now you see that the development server in the console continues.

Reloading webpages

Now everything works as good as when using the Eclipse plugin, right? Not quite. There is one thing that doesn’t work: dynamic reload of webpages, such as JSP or CSS files. Jetty allows dynamic reload, but when using Maven, Jetty does not use the src/main/webapp folder as working directory; instead it uses its own directory somewhere in target/…

To avoid long edit / build / deploy / run cycles, the recommended way at the moment is to run mvn gae:run in one console window and mvn cli:execute in another window. The command line interface allows you to quickly execute Maven goals. Run compile war to update the webpages in the development server’s working directory.

While this is not quite as simple as with Eclipse, it is a workaround that speeds up the development process significantly.

Development environment for GAE

Samstag, September 26th, 2009

My current environment for GAE/J development consists of:

Snow Leopard, Java 6, GWT and Eclipse

Sonntag, September 20th, 2009

After upgrading to Snow Leopard, I experienced some well known issues in Java development: a) Java 5 has been removed from the computer and b) GWT doesn’t work anymore. While a) is not too bad (but not nice either), b) is a real pain. The reason why GWT doesn’t work is not caused by Apple, but the crappy implementation for a 32-bit runtime by Google. Luckily there is a way to work around this problem. The Lombardi blog has an entry explaining the reasons and what needs to be done.

In short: download the GWT source, patch the BootStrapPlatform class and make sure GWT is started in 32-bit mode.

In this solution I assume, you are using the Google Eclipse Plugin as described in the documentation.

Download the latest source from SVN: svn checkout http://google-web-toolkit.googlecode.com/svn/trunk/ trunk.
Find the class BootStrapPlatform (make sure it is the Mac OS X relevant class!).
BootStrapPlatform Class
Now, drag the class into your Eclipse project. Eclipse will show two errors: The package will be incorrect and the classes GraphicsEnvironment and Toolkit will be not validated. Fix both errors (“quick fix”, for the second error choose “Exclude ‘BootStrapPlatform.java’ from App Engine validation”.
Now change the method isJava5 to return true:


  private static boolean isJava5() {
      return true;
      // return System.getProperty("java.version").startsWith("1.5");
  }

Now change the run configuration of the project and add the VM argument -d32.
That’s it. But hopefully, Google will patch the GAE SDK soon.

Run GAE Development Environment in Eclipse on the Mac

Sonntag, November 30th, 2008

I mentioned already how to set up Eclipse to get code completion for the Google App Engine development environment. To run the application from inside Eclipse has some advantages, too: All errors are logged to the console and you can directly jump to the error location in the code.

The run configuration needs to use the following main module:

/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py

Enabling Code Completion for Google App Engine in Eclipse on Mac OS X

Samstag, November 29th, 2008

In addition to this article, on Mac OS X the setup should look like this:

My Development Environment

Samstag, November 29th, 2008

As CloudMe will not just focus on Java development, but will also utilize GAE (Google App Engine), I had to modify my development environment to support Python. I decided to use Eclipse as I’m already familiar with it from the Java development (I tried NetBeans, which is also really good, and needs less memory, but being more familiar with Eclipse made the difference). For this project I did a clean install:

For GAE, some documentation is required (considering that I’m new to Python):