Mobile Server I-jetty download compilation installation and problem solving series

Source: Internet
Author: User

Because the new project needs to be in a device on an Android platform to the Web server and provide intranet access to the Web program through the browser, then consider Google's Open source project jetty for Android, originally because there is no contact has been prepared to encounter a series of problems, But guessed the beginning but did not guess the end, the process is quite bumpy. This is also the reason why this essay, one for their long memory, and secondly, for the jetty for Android, the network of those macabre information is so I have no words, useless blog is too much, some in the time to see people are ignorant circle, so this essay for finishing purposes.

First, the Convention environment Description: Windows XP SP3 (bitter Company), JDK1.7, Apache Maven 3.2.5, Git 2.6.4, Eclipse Luna 4.4.2.

About the environment preparation here is not to explain, I believe that as a software developer, regardless of the veteran rookie above these tools should all play 666, how can not be installed not configured it. However, make sure that the following fields have been declared in the system variables, and that the directories described after the "import" text are introduced into the Path property:

Java_home--Java JDK root path--import:\bin;\jre\bin

Maven_home--Maven Root path--import:\bin

Android_home--Android SDK Root path--import:\tools;\platform-tools

1,download

Refer to the jetty for Android Project home page to use git to sync i-jetty code locally.

$ git clone https://github.com/jetty-project/i-jetty.git

When viewing the home page for the jetty for Android project, note that the version of MAVEN is not described in the depedencies when the description is in the pages, but the version of the class library jar package that the POM manifest relies on by default in the project is incompatible with the version of Maven used by the current system. There are a number of issues to follow when compiling the project, and it is important to note that the support relationship for the version of the class library in the project and the MAVEN version is described below.

2,building

This project contains the APK project and the War project, the first thing to do is not to open eclipse to Import Maven project, or wait for you will be a nightmare, and the first thing to do is to modify the project Pom file to adapt to the local environment, Then use MAVEN to synchronize the corresponding dependent class library entries to determine that the local environment adapts to the project's compilation process.

Project by default in the use of old can not be older Android API 4 platform, the author is also enough nostalgic, we do not change it to use <PLATFORM>4</PLATFORM>, but please confirm that the system has downloaded the API 4 SDK Platform, otherwise refer to this pro provided download Android API 4 Platform.

Note that the decompression should not be extracted directly into the android_home, refer to the directory structure of the SDK, should be established in the Platforms,samples,system-images directory android-4 place the corresponding files, tools directory files please seat.

At this point we also need to modify the Pom files in the project according to the MAVEN version, such as my Apache Maven 3.2.5:i-jetty\i-jetty\i-jetty-ui\pom.xml

      <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <art ifactid>android-maven-plugin</artifactid><!--Change It--<version>3.8.2</version><!--                  Change it again--<extensions>true</extensions> <configuration> <sdk> <platform>4</platform> </sdk> <deleteconflictingfiles>true </deleteConflictingFiles> <extractDuplicates>true</extractDuplicates> <und            Eploybeforedeploy>true</undeploybeforedeploy> </configuration> <executions>    <execution> ... </execution> </executions> </plugin> <profiles> <profile> <id>sign</id> <build> <             Plugins>       <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId>                        <artifactId>android-maven-plugin</artifactId><!--and change it here-- <configuration> <sign> <debug>false</debug > </sign> </configuration> </plugin > </plugins> </build> </profile> </profiles>

  * Note: Maven-android-plugin has been renamed to Android-maven-plugin at 3.0.0, and maven-android-plugin:2.9.0-beta-5 is still being used in the project. The author is exposed to age.

If other MAVEN versions are specific, please refer to the following versions to support the scope of modifications:

Maven 3.0.3--android-maven-plugin:3.0.0

Maven 3.0.5--android-maven-plugin:3.3.0~3.5.3

Maven 3.1.1--android-maven-plugin:3.8.0~3.8.1

After the modification, the command line navigates to the I-jetty\i-jetty directory to start compiling the APK:

MVN clean Install

At this point maven synchronizes dependencies from the Pom list to Maven's local repository, and here you begin to pray ...--(here according to the speed of the fast forward if the time)--if everything is correct, the following compilation results will appear:

    

3,using I-jetty

Check i-jetty-ui\target\ found that the APK--i-jetty-3.2-snapshot.apk, which has been compiled successfully, is installed on the device:

ADB install-s "C:\Documents and settings\administrator\i-jetty\i-jetty\i-jetty-ui\target\i-jetty-3.2-snapshot.apk"
4,building Console

Continue compiling the Web project, and also modify the POM manifest to fit the local compilation environment: I-jetty\console\webapp\pom.xml--line 70th starts

     <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin< /artifactid> <version>1.2</version> <executions> <!--Convert the compiled Classes into a clases.dex. -<execution> <id>generate-dex</id> <phase>process-classes< /phase> <goals> <goal>exec</goal> </goals> <co nfiguration> <executable>java</executable> <arguments> <a                Rgument>-jar</argument> <!--instead, the correct path to the Dx.jar extracted from Android API 4 needs to be used to package the Clss file as a Dex file-- <argument>${env. Android_home}/build-tools/android-4.4/lib/dx.jar</argument> <!--<argument>-jxmx1024m</arg Ument>--> <argument>--dex</argument> <argument>--verbose</argument> <argument>--core-library</argument> < Argument>--output=${project.build.directory}/classes.dex</argument> <argument>--positions=li Nes</argument> <argument>${project.build.directory}/classes/</argument> &L T;argument>${project.build.directory}/generated-classes/</argument> </arguments> &L t;/configuration> </execution> </executions> </plugin>

  

After the modification, the command line navigates to the I-jetty\console\webapp directory to start compiling the war:

MVN clean Install

Another anxious waiting ...

    

5,using Console
ADB push "C:\Documents and Settings\administrator\i-jetty\console\webapp\target\console-3.2-snapshot.war"/storage/ sdcard0/jetty/webapps/
6,browser Console

View device WiFi Connector information and access from the browser

ADB shell[email protected]:/$ netcfg

  

Mobile Server I-jetty download compilation installation and problem solving series

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.