-
Notifications
You must be signed in to change notification settings - Fork 0
Building Project Maven Eclipse
- Please read the Configuration page first
- Looking for an example? See this project.
Follow the Getting Started page of the m2eclipse-android-integration plugin to create / import your project as a Maven + Android project.
The Maven configuration enables AndroidAnnotations usage from the command line (e.g using mvn package). However, since Eclipse uses its own compiler, you also need to configure it.
You can configure Eclipse in three different ways:
- Using the m2e-apt eclipse plugin
- Manual configuration pointing to your local Maven Repo
- Manual configuration pointing to a downloaded Jar with dependencies
The m2e-apt handles Eclipse configuration for you. We know it works fine with Eclipse Juno, however you may run into troubles with previous Eclipse versions.
- Install Maven Integration for Eclipse JDT APT (m2e-apt plugin) from the m2e-apt update site: http://download.jboss.org/jbosstools/updates/m2e-extensions/m2e-apt
- Right-click your project, choose Properties
- Go to Maven > Annotation Processing
- Check Enable project specific settings
- Select Automatically configure JDT APT
- Select Project > Clean... and run a clean build of your project
- Right-click your project, choose Properties
- Go to Java Compiler > Annotation Processing and choose Enable annotation processing
- Go to Java Compiler > Annotation Processing > Factory Path
- Click on Add Variable, select M2_REPO and click on Extend...; then, select the following JAR :
com/googlecode/androidannotations/androidannotations-api/X.X/androidannotations-api-X.X.jar - Click on Add Variable, select M2_REPO and click on Extend...; then, select the following JAR :
com/sun/codemodel/codemodel/2.4.1/codemodel-2.4.1.jar - Click on Add Variable, select M2_REPO and click on Extend...; then, select the following JAR :
com/googlecode/androidannotations/androidannotations/X.X/androidannotations-X.X.jar - Confirm the workspace rebuild
The previous manual configuration can also be created by adding the following files at the root of your project:
- .factorypath
<factorypath>
<factorypathentry kind="PLUGIN" id="org.eclipse.jst.ws.annotations.core" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/googlecode/androidannotations/androidannotations/X.X/androidannotations-X.X.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/googlecode/androidannotations/androidannotations-api/X.X/androidannotations-api-X.X.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/sun/codemodel/codemodel/2.4.1/codemodel-2.4.1.jar" enabled="true" runInBatchMode="false"/>
</factorypath>- .settings/org.eclipse.jdt.apt.core.prefs
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genSrcDir=.apt_generated
org.eclipse.jdt.apt.reconcileEnabled=true
This configuration is similar to the configuration of the processor in Eclipse without Maven. The
androidannotations-X.X.jarjar in the bundle already containsandroidannotations-api-X.X.jarandcodemodel-2.4.1.jar
- Download the zip bundle
- Put
androidannotations-X.X.X.jarin a specific folder, such ascompile-libs - Right-click your project, choose Properties
Go to
Java Compiler > Annotation Processingand chooseEnable annotation processing - Go to
Java Compiler > Annotation Processing > Factory Pathand add the processor JAR :androidannotations-X.X.X.jar. - Confirm the workspace rebuild
- Start using AndroidAnnotations
Please read the Troubleshooting section of the Eclipse configuration page.
AndroidAnnotations was created by Pierre-Yves Ricau and is sponsored by eBusinessInformations.
04/03/2013 The 2.7.1 release is out
- Get started!
- Download
- Cookbook, full of recipes
- List of all available annotations
- Release Notes
- Examples
- Read the FAQ
- Join the Mailing list
- Create an issue
- Tag on Stack Overflow