2010-06-01 3 views
1

누구나 i-Jetty 용 앱을 만들었습니까? 나는 그것을 사용하기 시작하려하지만 .war 파일을 만들기 위해 무엇이 필요한지 이해하지 못한다. 덱스 내 .class 파일을 변경할 수있는 DX 도구를 사용할 때 나는i-Jetty 용 웹 애플리케이션

UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.RuntimeException:\...\ijetty\hello\HelloWorld.class: file not found
at com.android.dx.util.FileUtils.readFile(FileUtils.java:55)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:133) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
at com.android.dx.command.dexer.Main.processOne(Main.java:247)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)
at com.android.dx.command.dexer.Main.run(Main.java:139)
at com.android.dx.command.dexer.Main.main(Main.java:120)
at com.android.dx.command.Main.main(Main.java:89)
1 error; aborting

는 코드 섹션이 제대로 포맷 보통 어려운거야? 다음, 나는 덱스 내 클래스 파일 내 libs와 변환 할 필요가 알이 작은 블록 ...

를 해결

을 .WAR로 변환 10 분 저 사람이 여기에 나를 인도 할 수 있다면 나는 것 툭 크게 감사드립니다!

덕분에, 크리스 내가-부두에 대한 받는다는 빌드 파일을 생성 한

+0

내 클래스 파일이 있으며 dx 도구는이 예외와 함께 실패한 디렉토리도 허용합니다. – Cbudz

답변

1

다시 시간을 웹 어플리케이션. 명령 행 수출이 환경 변수에

sampleapp/ 
    |-- pom.xml 
    `-- src 
     `-- main 
      |-- java 
      | `-- {java sources} 
      `-- webapp 
       |-- {html js css sources} 
       `-- WEB-INF 
        `-- web.xml 

: 당신은 유형이 있음을 완료 한 후

$>export ANDROID_HOME=/path/to/android/sdk 
    $>export ANDROID_PLATFORM=7 OR 8 or whatever platform you are using 

: (당신이 받는다는 있다고 가정 2.1 설치된 웹 애플리케이션 소스의 디렉토리 구조는 다음과)

$>mvn package 

이 대상 디렉토리에 sampleapp.war 파일을 생성합니다. i-jetty에 배치 할 수 있습니다. 다음은 pom.xml입니다. 필요에 맞게 pom.xml에서 artifactId 및 이름을 변경하십시오.

<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"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>sampleapp</groupId> 
    <artifactId>sampleapp</artifactId> 
    <packaging>war</packaging> 
    <name>sampleapp</name> 
    <description>Sample Web application</description> 
    <version>1.0-a1</version> 

    <properties> 
     <android.home>${env.ANDROID_HOME}</android.home> 
     <android.platform.version>${env.ANDROID_PLATFORM}</android.platform.version> 
     <android.platform>platforms/android-${android.platform.version}</android.platform> 
     <android.framework.aidl>${android.home}/${android.platform}/framework.aidl</android.framework.aidl> 
     <android.jar>${android.home}/${android.platform}/android.jar</android.jar> 

     <android.tools.aapt>${android.home}/${android.platform}/tools/aapt</android.tools.aapt> 
     <android.tools.dx>${android.home}/${android.platform}/tools/dx</android.tools.dx> 
     <android.tools.apkbuilder>${android.home}/tools/apkbuilder</android.tools.apkbuilder> 
     <android.tools.aidl>${android.home}/${android.platform}/tools/aidl</android.tools.aidl> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.mortbay.jetty</groupId> 
      <artifactId>servlet-api</artifactId> 
      <version>2.5-20081211</version>  
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>android</groupId> 
      <artifactId>android</artifactId> 
      <version>2.2_r1</version> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>build-helper-maven-plugin</artifactId> 
       <version>1.4</version> 
       <executions> 
       <execution> 
        <phase>generate-sources</phase> 
        <goals> 
         <goal>add-source</goal> 
        </goals> 
        <configuration> 
         <sources> 
          <source>${project.build.directory}/generated-sources</source> 
         </sources> 
        </configuration> 
       </execution> 
       </executions> 
      </plugin> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <executions> 
       <execution> 
        <id>unpack-dependencies</id> 
        <phase>generate-sources</phase> 
        <goals> 
         <goal>unpack-dependencies</goal> 
        </goals> 
        <configuration> 
         <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact> 
         <excludeArtifactIds>servlet-api,android</excludeArtifactIds> 
         <excludeTransitive>true</excludeTransitive> 
         <outputDirectory>${project.build.directory}/generated-classes</outputDirectory> 
        </configuration> 
       </execution> 
       </executions> 
      </plugin> 

      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>exec-maven-plugin</artifactId> 
       <version>1.1</version> 
       <executions> 
       <!-- Generate any aidl interfaces --> 
       <!-- 
       <execution> 
        <id>aidl-generate</id> 
        <phase>generate-sources</phase> 
        <goals> 
         <goal>exec</goal> 
        </goals> 
        <configuration> 
         <executable>${android.tools.aidl}</executable> 
         <arguments> 
          <argument>-I${basedir}/src/</argument> 
          <argument>-o${project.build.directory}/generated-sources/</argument> 
          <argument>-p${android.framework.aidl}</argument> 
          <argument>${basedir}/src/main/java/com/mycompany/MyService.aidl</argument> 
         </arguments> 
        </configuration> 
       </execution> 
       --> 

       <!-- Convert the compiled classes into a clases.dex. --> 
       <execution> 
        <id>generate-dex</id> 
        <phase>process-classes</phase> 
        <goals> 
         <goal>exec</goal> 
        </goals> 
        <configuration> 
         <executable>${android.tools.dx}</executable> 
         <arguments> 
          <!--<argument>-JXmx1024M</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> 
          <!-- uncomment this line if you have any generated classes such as aidl interfaces --> 
          <!-- argument>${project.build.directory}/generated-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> 
    </project>