有誰知道如何調試在i-Jetty上託管的使用Android API的java servlet?如何在Android上使用Eclipse爲Jetty調試servlet(iJetty)?
對於常規網站(而不是Android/i-jetty),可以使用Debug As - > Debug On Server在本地服務器上使用Eclipse EE進行調試。
對於Android應用程序,我使用Eclipse的Android開發工具並運行Debug As - > Android Application。
但是,在這種情況下,我將Android代碼打包在一場戰爭中。
我使用下面的POM.xml文件和maven來打包供i-Jetty使用的war文件。它運行dx實用程序將servlet從Java轉換爲Dalvik。我可以部署結果並在Android上的i-jetty上運行它。但是,我無法弄清楚如何用除LogCat打印輸出之外的其他方法調試servlet調用。我考慮試圖讓Eclipse構建的i-jetty(它也是用maven構建的),並且看看ADT是否可以追蹤到servlet的執行情況,但不知道這條路是否有成效。
<?xml version="1.0" encoding="UTF-8" ?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<parent>
<groupId>org.mortbay.ijetty</groupId>
<artifactId>example-webapps-parent</artifactId>
<version>3.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blahblah</artifactId>
<name>I-Jetty :: blahblah</name>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<verbose>false</verbose>
</configuration>
</plugin>
<!-- Convert the compiled classes into a clases.dex.
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>generate-dex</id>
<phase>process-classes</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<!-- executable>${env.ANDROID_HOME}/platform-tools/dx</executable
-->
<executable>java</executable>
<arguments>
<!-- <argument>-JXmx1024M</argument>
-->
<argument>-jar</argument>
<argument>${env.ANDROID_HOME}/platform-tools/lib/dx.jar</argument>
<argument>--dex</argument>
<argument>--verbose</argument>
<argument>--core-library</argument>
<argument>--output=${project.build.directory}/classes.dex</argument>
<argument>--positions=lines</argument>
<argument>${project.build.directory}/classes/</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copydex</id>
<phase>process-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<mkdir dir="${project.build.directory}/${project.artifactId}-${project.version}/WEB- INF/lib" />
<jar basedir="${project.build.directory}" update="true" includes="classes.dex" destfile="${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/lib/classes.zip" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>repo</id>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>file://${project.basedir}/repo</url>
</repository>
</repositories>
</project>
謝謝。這是肯定的,但我只是希望有一種方法來使用調試器 – bluesky