¿Maven integration?

  ... the case you feel the need for a new feature or want to submit one.

¿Maven integration?

Postby rkpost » Fri Oct 15, 2010 7:19 pm

Hi Nicolas,

Do you think that you'll add integration with maven?

I downloaded all projects (main, examples and extension) and I added it pom.xml files in order to compile it with maven android plugin. Usefull to develop with Netbeans or IntelliJ IDEA.
rkpost
 
Posts: 201
Joined: Tue Sep 14, 2010 5:52 am
Location: Buenos Aires

Re: ¿Maven integration?

Postby Nicolas Gramlich » Fri Oct 15, 2010 10:28 pm

Hi,

sorry I have no idea of Maven :(
Isn't it some kind of dependency-management / build tool :?:

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: ¿Maven integration?

Postby rkpost » Sat Oct 16, 2010 4:54 am

Yes, like Ant but more easy to configurate (by xml).

With maven you may describe with a XML your proyect name, modules, description, tasks (build, deploy, test, customs) and dependencies. When you compile with maven, it searchs in repositories (own repository and others) the jars that you need.

For example,
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2.  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3.     <modelVersion>4.0.0</modelVersion>
  4.     <groupId>andengine</groupId>
  5.     <artifactId>andengine</artifactId>
  6.     <packaging>jar</packaging>
  7.     <version>1.0.0</version>
  8.     <name>${artifactId}</name>
  9.     <url>http://maven.apache.org</url>
  10.  
  11.     <build>
  12.         <resources>
  13.             <resource>
  14.                 <directory>${basedir}/src/</directory>
  15.                 <includes>
  16.                     <include>**/*.java</include>
  17.                 </includes>
  18.             </resource>
  19.         </resources>
  20.         <plugins>
  21.             <plugin>
  22.                 <groupId>org.apache.maven.plugins</groupId>
  23.                 <artifactId>maven-compiler-plugin</artifactId>
  24.                 <configuration>
  25.                     <source>1.6</source>
  26.                     <target>1.6</target>
  27.                 </configuration>
  28.             </plugin>
  29.         </plugins>
  30.         <sourceDirectory>${basedir}/src/</sourceDirectory>
  31.     </build>
  32.  
  33.     <dependencies>
  34.        
  35.         <dependency>
  36.             <groupId>junit</groupId>
  37.             <artifactId>junit</artifactId>
  38.             <version>3.8.1</version>
  39.             <scope>test</scope>
  40.         </dependency>
  41.  
  42.         <dependency>
  43.             <groupId>com.google.android</groupId>
  44.             <artifactId>android</artifactId>
  45.             <version>2.1.2</version>
  46.             <scope>provided</scope>
  47.         </dependency>
  48.  
  49.     </dependencies>
  50.  
  51. </project>
  52.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


I used this pom.xml (Maven only use this file) to describe andengine project. When I run "mvn compile", Maven builds andengine with java 1.6, include all java files in the jar and use the Android API 2.1.2 to compile. If I run "mvn install", that jar are installer in my own repository, that means when another project needs andgine, maven includes the jar.


This is the pom.xml of my game (for example)

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2.  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3.     <modelVersion>4.0.0</modelVersion>
  4.     <groupId>com.rkpost.test</groupId>
  5.     <artifactId>game</artifactId>
  6.     <packaging>apk</packaging>
  7.     <version>1.0-SNAPSHOT</version>
  8.     <name>game</name>
  9.     <url>http://maven.apache.org</url>
  10.  
  11.     <build>
  12.         <resources>
  13.             <resource>
  14.                 <directory>${basedir}/res</directory>
  15.             </resource>
  16.             <resource>
  17.                 <directory>${basedir}/assets</directory>
  18.             </resource>
  19.             <resource>
  20.                 <directory>${basedir}/libs</directory>
  21.             </resource>
  22.         </resources>
  23.         <pluginManagement>
  24.             <plugins>
  25.                 <plugin>
  26.                     <groupId>com.jayway.maven.plugins.android.generation2</groupId> <!-- plugin to compile APK files -->
  27.                     <artifactId>maven-android-plugin</artifactId>
  28.                     <version>2.6.0</version>
  29.                     <configuration>
  30.                         <sdk>
  31.                             <path>/usr/share/android/</path>
  32.                             <platform>7</platform>
  33.                         </sdk>
  34.                         <deleteConflictingFiles>true</deleteConflictingFiles>
  35.                         <undeployBeforeDeploy>true</undeployBeforeDeploy>
  36.                         <device>usb</device>
  37.                     </configuration>
  38.                     <extensions>true</extensions>
  39.                 </plugin>
  40.             </plugins>
  41.         </pluginManagement>
  42.         <plugins>
  43.             <plugin>
  44.                 <groupId>org.apache.maven.plugins</groupId>
  45.                 <artifactId>maven-compiler-plugin</artifactId>
  46.                 <configuration>
  47.                     <source>1.6</source>
  48.                     <target>1.6</target>
  49.                 </configuration>
  50.             </plugin>
  51.             <plugin>
  52.                 <groupId>com.jayway.maven.plugins.android.generation2</groupId>
  53.                 <artifactId>maven-android-plugin</artifactId>
  54.             </plugin>
  55.         </plugins>
  56.     </build>
  57.  
  58.     <dependencies>
  59.        
  60.         <dependency>
  61.             <groupId>junit</groupId>
  62.             <artifactId>junit</artifactId>
  63.             <version>3.8.1</version>
  64.             <scope>test</scope>
  65.         </dependency>
  66.  
  67.         <dependency>
  68.             <groupId>com.google.android</groupId>
  69.             <artifactId>android</artifactId>
  70.             <version>2.1.2</version>
  71.             <scope>provided</scope>
  72.         </dependency>
  73.  
  74.         <dependency>
  75.             <groupId>andengine</groupId>
  76.             <artifactId>andengine</artifactId>
  77.             <version>1.0.0</version>
  78.             <scope>compile</scope>
  79.         </dependency>
  80.  
  81.         <dependency>
  82.             <groupId>andengine</groupId>
  83.             <artifactId>andengine-multitouch</artifactId>
  84.             <version>1.0.0</version>
  85.             <scope>compile</scope>
  86.         </dependency>
  87.  
  88.         <dependency>
  89.             <groupId>andengine</groupId>
  90.             <artifactId>andengine-physicsbox2d</artifactId>
  91.             <version>1.0.0</version>
  92.             <scope>compile</scope>
  93.         </dependency>
  94.  
  95.     </dependencies>
  96. </project>
  97.  
Parsed in 0.006 seconds, using GeSHi 1.0.8.4
rkpost
 
Posts: 201
Joined: Tue Sep 14, 2010 5:52 am
Location: Buenos Aires

Re: ¿Maven integration?

Postby Nicolas Gramlich » Mon Oct 18, 2010 1:49 pm

That looks cool, can it be easily integrated into Eclipse :?:

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: ¿Maven integration?

Postby rkpost » Mon Oct 18, 2010 6:40 pm

Yes, with Maven Eclipse Plugin (http://maven.apache.org/plugins/maven-eclipse-plugin/).

The advantage is that if you have an Archiva Repository (http://archiva.apache.org/), when you compile a new version, it is installed in your repository. Then all of us increment version number in pom.xml. When we compile again, Maven is going to search into your repository (if we specify the URL) the new version.
rkpost
 
Posts: 201
Joined: Tue Sep 14, 2010 5:52 am
Location: Buenos Aires

Re: ¿Maven integration?

Postby gutomaia » Thu Jul 28, 2011 6:07 am

Hi!

I've have recently downloaded the source code, and I've also missed a maven pom.xml.
So I've looked upon the thread to see if someone had already mentioned it. And course, it was mentioned.

For me it is a single pom.xml file that really help me integrate easily with my projects.

I see that this thread is kind of dead. That subject is already closed?

thanks
gutomaia
 
Posts: 1
Joined: Thu Jul 28, 2011 6:01 am

Re: ¿Maven integration?

Postby halmafest » Sun Oct 16, 2011 8:21 pm

Hi,

I like to use andengine for a project. I had a lot of trouble to set up the linkage between all the subprojects. I think the usage of maven can be very helpful to get this solved. With the search I found this thread and I like to ask if there is any update related to this.

Advatages I see whenn using maven:
    - libaries can easy be released, this will allow to use the andengine libs without the need to checkout and compile the project thereself
    - the setup of the procect will be easier
    - no eclipse related files in the source files -> the command "mvn eclipse:eclipse" can create the files after checkout -> import project -> done
Disadvantages:
    other tool needs to be introduced

I'm using maven since 4 years at work and i'm happy with it. If you have any question please let me know.

Christian
halmafest
 
Posts: 2
Joined: Sun Oct 16, 2011 8:04 pm

Re: ¿Maven integration?

Postby xeperis » Wed Apr 18, 2012 8:42 am

Hello, I would like to share my opinion on maven integration and I am really for it. The best part about maven integration is not only that this engine could be downloaded from maven central repo, but it would make one hell of an easy job for versioning. If new version of andEngine should be released all we had to do is change version in xml and maven would take care of the rest - easy migrations.

And as for maven integration, all the dev IDE's have support for maven "NetBeans", "Eclipse", "Intellij Idea".
xeperis
 
Posts: 8
Joined: Tue May 31, 2011 3:52 pm

Re: ¿Maven integration?

Postby bkiers » Tue May 14, 2013 10:36 pm

You simply need to add a POM to the AndEngine project that, upon `mvn install`, will install the AndEngine Lib as an APKLIB which you can then use in other Android projects as a dependency.

See: https://github.com/bkiers/AndEngine for more info.
bkiers
 
Posts: 1
Joined: Tue May 14, 2013 10:34 pm


Return to Features

Who is online

Users browsing this forum: No registered users and 7 guests