Você está na página 1de 3

first install maven: download: Maven 3.0.5 from http://maven.apache.org/download.cgi install: windows 1. Unzip the distribution archive, i.e.

apache-maven-3.0.5-bin.zip to the direct ory you wish to install Maven 3.0.5. These instructions assume you chose C:\Prog ram Files\Apache Software Foundation. The subdirectory apache-maven-3.0.5 will b e created from the archive. 2. Add the M2_HOME environment variable by opening up the system properties (Win Key + Pause), selecting the "Advanced" tab, and the "Environment Variables" butt on, then adding the M2_HOME variable in the user variables with the value C:\Pro gram Files\Apache Software Foundation\apache-maven-3.0.5. Be sure to omit any qu otation marks around the path even if it contains spaces. Note: For Maven 2.0. 9, also be sure that the M2_HOME doesn't have a '\' as last character. 3. In the same dialog, add the M2 environment variable in the user variables wit h the value %M2_HOME%\bin. 4. Optional: In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven. 5. In the same dialog, update/create the Path environment variable in the user v ariables and prepend the value %M2% to add Maven available in the command line. 6. In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK, e.g. C:\Prog ram Files\Java\jdk1.5.0_02 and that %JAVA_HOME%\bin is in your Path environment variable. 7. Open a new command prompt (Winkey + R then type cmd) and run mvn --version to verify that it is correctly installed. following steps from this tutorial: http://www.scottlogic.co.uk/2012/06/using-ph onegap-build-with-maven/ Building your first app befor this command: mvn com.github.chrisprice:phonegap-build-maven-plugin:list -Dphonegap-build.user name=[USERNAME] -Dphonegap-build.password=[PASSWORD] you have to make a maven project go to your destination folder ex. cd C:\Users\Kevin.thomas\Desktop\ExampleMaven make maven project mvn archetype:generate -DgroupId=example.maven.app -DartifactId=my-webapp -Darch etypeArtifactId=maven-archetype-webapp when command line ask you for the version enter 1.0.0 If everything is correct you'll get the following [INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESS [INFO] -----------------------------------------------------------------------[INFO] Total time: 5:44.263s [INFO] Finished at: Wed Feb 27 11:50:13 CET 2013 [INFO] Final Memory: 7M/18M [INFO] ------------------------------------------------------------------------

source: http://maven.apache.org/guides/mini/guide-webapp.html Follow now the tutorial: Building your app Enter following command with your credentials mvn com.github.chrisprice:phonegap-build-maven-plugin:list -Dphonegap-build.user name=[USERNAME] -Dphonegap-build.password=[PASSWORD] output INFO: basic authentication scheme selected [INFO] Requesting summary from cloud. [INFO] Found 1 apps [INFO] 312258: PG Build App [INFO] Found 0 ios keys [INFO] Found 0 android keys [INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESS [INFO] -----------------------------------------------------------------------[INFO] Total time: 1:01.864s [INFO] Finished at: Wed Feb 27 11:57:26 CET 2013 [INFO] Final Memory: 4M/15M [INFO] -----------------------------------------------------------------------Insert the following text in the pom.xml file of your project under the build ta g <plugins> <plugin> <groupId>com.github.chrisprice</groupId> <artifactId>phonegap-build-maven-plugin</artifactId> <version>0.0.2</version> <executions> <execution> <id>phonegap-build</id> <!-- the goals are lifecycle bound by default --> <goals> <goal>clean</goal> <goal>build</goal> </goals> <configuration> <platforms> <platform>android</platform> </platforms> </configuration> </execution> </executions> </plugin> </plugins> Now create a phonegap-build folder in ExampleMaven\my-webapp\src\main folder. In the phonegap-build folder create a new config.xml file and insert following t ext. <?xml version="1.0" encoding="UTF-8" ?> <widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ ns/1.0" id="example.maven.app.my-webapp" version="1.0.0">

<name>PhoneGap Build Sample</name> <description> A sample for phonegap-build-maven-plugin. </description> <author href="" > Kevin thomas </author> </widget> When you have done this, you should be able to run the following with your crede ntials cd my-webapp mvn clean install -Dphonegap-build.username=[USERNAME] -Dphonegap-build.password =[PASSWORD] if you get the following error: [INFO] Starting upload. [INFO] -----------------------------------------------------------------------[INFO] BUILD FAILURE [INFO] -----------------------------------------------------------------------[INFO] Total time: 12.679s [INFO] Finished at: Wed Feb 27 13:07:02 CET 2013 [INFO] Final Memory: 7M/18M [INFO] -----------------------------------------------------------------------[ERROR] Failed to execute goal com.github.chrisprice:phonegap-build-maven-plugin :0.0.2:build (phonegap-build) on project my-webapp: Execution phonegap-build of goal com.github.chrisprice:phonegap-build-maven-plugin:0.0.2:build failed: Priva te app limit reached: Client response status: 400 -> [Help 1] means that you have reached the limit of private apps. You need an id of an excisting app that you want to overwrite and then you have to insert the following in the pom.xml file under plugin <configuration> <appId>[AppIdNumber]</appId> </configuration> Your app is succesful build when you get this [INFO] [INFO] [INFO] [INFO] [INFO] [INFO] [INFO] [INFO] [INFO] [INFO] [INFO] [INFO] Requesting summary from cloud. Found 1 apps 312258: PhoneGap Build Sample Found 0 ios keys Found 0 android keys -----------------------------------------------------------------------BUILD SUCCESS -----------------------------------------------------------------------Total time: 5.908s Finished at: Wed Feb 27 13:30:51 CET 2013 Final Memory: 4M/15M ------------------------------------------------------------------------

Você também pode gostar