How to disable m2e build in Eclipse Indigo? - android

I'm currently using Eclipse Indigo in an Android project that I'm working on and am running into problems with the built-in Maven (m2e) builder. I use the ADT plug-in to build the project, but I also have a Maven pom.xml that's used to build the project from the command line. Once I switched from Helios to Indigo, I started seeing these errors:
Plugin execution not covered by lifecycle configuration: com.jayway.maven.plugins.android.generation2:maven-android-plugin:2.9.0-beta-5:generate-sources (execution: default-generate-sources, phase: generate-sources)
Plugin execution not covered by lifecycle configuration: com.jayway.maven.plugins.android.generation2:maven-android-plugin:2.9.0-beta-5:unpack (execution: default-unpack, phase: process-classes)
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (execution: default-jar, phase: process-classes)
My goal is to keep the Maven build separate from the ADT Eclipse build so I'd like to simply disable m2e for the project but I can't figure out how to do that.
Is there a way to disable the m2e builder? Alternatively, is there a way to fix the above errors?

Open your POM and click on the "Plugin execution not covered by lifecycle configuration" error. This will give you the option to Discover new m2e connectors.
Select this and you should be automatically prompted to download and install the Android Connector.
Installing this should resolve your problems. You should probably uninstall the old 0.2.4 m2eclipse-android-integration as well in favour of the new 0.3.0 m2e-android version.
Please see the new site for more information:
http://rgladwell.github.com/m2e-android/

M2E official wiki documents this issue
I think you can use lifecycle-mapping plugin from m2e to silently ignore the execution for these plugins

I went into my install directory for Eclipse and manually removed all the references to m2e.
There were multiples in the "Plugin" directory and the "features" directory.
After that my android project was back to behaving like normal and I could use mvn from the command line to build.

I am using MacOSX with Eclipse 4.3 (Krepler). What I originally tried was to install Maven via the terminal using Brew. It installed correctly Maven 3.0.4. However when I tried to import any ready maven projects (File > Import > Maven) it would display the following two errors:
No marketplace entries found to handle Execution default-testResources
What I did is go to Help > Eclipse Marketplace and type "Maven" in the search bar and install the first default Maven client for Eclipse. Everything worked for me from this point.
Hope it helps to you too.

Related

Cordova build error: "Could not resolve all dependencies for configuration ':_debugApkCopy' > Could not find com.android.support:appcompat-v7:27.0.2."

It's been now two days I'm fighting with this issue.
I'm trying to build a cordova project that built marvelously like 1 month ago.
In between these time periods I had to change my PC so I installed again Java, Android Studio and Cordova, setting it up as usual.
I installed Google Repository (v58) as well as Android Support Repository (v47.0.0) in the SDKManager.
They appears to be the latest since I tried to uninstall and reinstall them twice.
I didn't change my project's configuration since I took a backup of it when it was working to start again.
When I run cordova build android, I got this error:
A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':_debugApkCopy'.
Could not find com.android.support:appcompat-v7:27.0.2.
Searched in the following locations:
file:/C:/Users/Pierrick/AppData/Local/Android1/extras/android/m2repository/com/android/support/appcompat-v7/27.0.2/appcompat-v7-27.0.2.pom
file:/C:/Users/Pierrick/AppData/Local/Android1/extras/android/m2repository/com/android/support/appcompat-v7/27.0.2/appcompat-v7-27.0.2.jar
file:/C:/Users/Pierrick/Desktop/hAz4rd0uS-uphair-1af95815ef72/hAz4rd0uS-uphair-1af95815ef72/platforms/android/sdk-manager/com/android/support/appcompat-v7/27.0.2/appcompat-v7-27.0.2.jar
These files are needed by plugins cordova-plugin-mapbox (v1.2.3) and cordova-plugin-facebook4 (v1.9.1). Obviously, I checked the "extras" folder in my Android SDK directory, and the last version of Android support I got is 26.0.0-alpha1.
How can I manage to download the requested files in the good location ?
Is it supposed to be done automatically ?
I really don't see what I am missing here, some help would really be appreciated.
I tried to:
-Reinstall cordova-android by cordova platform rm android and cordova platform add android#6.2.3;
-Delete gradle's android support's cache and metadatas as stated here;
-Reinstall Google repository and Android Support repository twice from Android Studio SDK Manager as stated here.
This is drivin' me nuts.
I just cam accross my problem and since I didn't see doublons of this thread I'm posting the answer here.
As stated in this thread the issue is caused by the facebook sdk. If you run in cordova CLI you simply have to modify the platforms/android/project.properties file.
Change this line:
cordova.system.library.1=com.facebook.android:facebook-android-sdk:4.+
into this line:
cordova.system.library.1=com.facebook.android:facebook-android-sdk:4.26.0
As stated in the relative thread, this is a hack.

Android application project in Eclipse and use gradle or maven to download JARS

I'm using Eclipse IDE Mars and the ADT android plugin and the sdk 23, and I always encounter problems when I try to install a .JAR all the sites where I download a JAR have a sample about how to install the JAR using Maven or Gradle, I tried to install Android for Maven Eclipse 1.4.0 (m2e) plugin but had the following error The following solutions are not available: Android for Maven Eclipse 1.4.0 (id=com.android.ide.eclipse.adt.feature.group, site=http://rgladwell.github.io/m2e-android/updates/).
So I tried to install gradle plugin instead to do so I followed this question:
Is there any way to integrate Eclipse with Gradle in Android project? and I installed the Gradle IDE plugin but I don't know where to go from here since all the documentation I can find it is for too advanced users I can't find a simple tutorial in how to create an android application and use gradle to download the JARS all the info that appears is a gradle.build where you put the name of the jars similar to maven dependencies.
My questions are
1) How can I solved this problem ``The following solutions are not available: Android for Maven Eclipse 1.4.0 (id=com.android.ide.eclipse.adt.feature.group, site=http://rgladwell.github.io/m2e-android/updates/)when I try to install the maven plugin, Since I already have used Maven before and I have a lillte more experience with it than with gradle.
2) How can I use the Gradle IDE eclipse plugin to just download the JARS in my android application default project or some example about How to transform a default Android project application created by Eclipse IDE and add gradle to this project so I can download JARS. ( I don't have the Gradle_home variable in my system variables I don't know if this is necesary since if I only download the plugin).
My goal is just to use anyone of this tools to download JARS

Building Android project in Jenkins "requires Maven version 3.1.1"

I'm building an Android project in Jenkins. Everything was fine until upgrading to the lastest plugin version, but now it fails with "requires Maven version 3.1.1". Fair enough, but Jenkins seems to be stuck on Maven 3.0.4, even though I'm using the latest version (currently 1.553) of Jenkins and all its plugins. How to I make it update to a more current release of Maven?
Building in Jenkins via android-maven-plugin, which as of version 3.8.0 requires Maven 3.1.1 or higher (see http://code.google.com/p/maven-android-plugin/wiki/Changelog). Of course it can be done manually, outside Jenkins. The question is how to get Jenkins to use a current Maven; it seems to come packaged with an older one, and I'm not familiar enough with it to see where/how to update.
Update: For anyone following my footsteps, note that upgrading Maven will break the Android build until android-maven-plugin is also updated; they go together.
Jenkins does not come with Maven, but it can install it for you.
To Update Maven version used by Jenkins
Goto Manage Jenkins -> Configure System.
Scroll down till you see Maven section (not Maven Configuration or Maven Project, those are different).
Click Add Maven button.
Leave Name as default.
Checkmark Install Automatically.
Install from Apache is the default installer option.
Select the version you want installed.
Besides "Install from Apache", you can also install it from a zip or by executing a command line. Just delete the apache installer and click Add Installer button to select another option.
I would suggest to run a dummy Maven project at least once to verify this gets installed.
Jenkins doesn't come with maven as far as I am aware of. You can specify a maven installation in the Jenkins settings. I usually use a reference to a symlink (debian) and let that symlink point to my "current" or preferred Maven version.
You can alternatively install a recent maven version via Jenkins in the Jenkins settings aswell. And on my Jenkins there is a 3.1.1 via apache available.

How do you install m2e-android-plugin in Eclipse?

I am trying to get setup to use Maven and pom.xml files in Eclipse for my Android projects. I have Eclipse Indigo setup (m2e included), Android SDK installed, ADT installed. I am struggling to understand what it means to "Install the m2e-android-plugin" (I am always taken to this page which provides instructions on installing it, but which I cannot follow) Specifically, when I go through the instruction on that page, after I complete all the steps in part 2, my structure does not have "Maven Dependencies" and my pom.xml file shows the following error:
Project build error: Unresolveable build extension: Plugin
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1 or one of its dependencies could
not be resolved: The following artifacts could not be resolved:
com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.1.1,
com.android.ddmlib:ddmlib:jar:r16, org.sonatype.sisu:sisu-inject-bean:jar:2.1.1,
org.sonatype.sisu:sisu-guice:jar:no_aop:2.9.4, org.codehaus.plexus:plexus- archiver:jar:2.0.1, junit:junit:jar:3.8.1,
org.codehaus.plexus:plexus-io:jar:2.0.1, org.codehaus.plexus:plexus-utils:jar:3.0, commons-jxpath:commons-
jxpath:jar:1.3, commons-io:commons-io:jar:2.0.1, org.ow2.asm:asm:jar:4.0, commons-lang:commons-lang:jar:
2.6, org.sonatype.aether:aether-util:jar:1.12: Failure to transfer
com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.1.1 from http://repo1.maven.org/
maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central
has elapsed or updates are forced. Original error: Could not transfer artifact
com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.1.1 from/to central (http://
repo1.maven.org/maven2): No response received after 60000
along with:
Project build error: Unknown packaging: apk
on the line
<packaging>apk</packaging>
I have tried set up a fresh second IDE myself and everything works as expected, suppose you have installed both Android SDK and Maven properly (better to use latest version), these are the only Eclipse plugins required to work with Mavenized Android Project:
adt
m2e
m2e-android
Check out my screenshot Help -> Install New Software... -> what is already installed:
If you follow instructions from this page starting with a new project, the <packaging> error is most likely due to earlie version of maven-release-plugin (if you do not explicitly specify one). By hovering mouse on <packaging> element in pom.xml, you should get some hint like:
maven-resources-plugin prior to 2.4 is not supported by m2e. Use maven-resources-plugin version 2.4 or later.
Adding the following plugin under <plugins>:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
</plugin>
Then Right-click on new project and select Maven -> Update Project Configuration, this should fix all error and give you a working example.
I had the same problem trying to install the android m2e in eclipse JUNO.
Then tried to install through "Install new software" wizard, instead of market place.
Add the following as an update site and select "Android For Maven eclipse" from the listed softwares and install.
http://rgladwell.github.com/m2e-android/updates - Thanks to #NullNoname for providing the update site.

Is it possible to set up an IntelliJ Android project to work with Maven?

I want to work with Maven dependencies in an IntelliJ Android project. Has anybody successfully done this?
I use IntelliJ IDEA (currently v11.0.2, build 111.277) on both Ubuntu 11.10 and Mac OS X 10.7.3 for working on Maven-based Android projects, and for the most part it works well. A nice thing about using IntelliJ with Android and Maven is that all support is already built-in - there are no extra IDE plugins to install.
As an example of a good working Android Maven project that can be opened with IntelliJ, you could use the source code of the open-source Gaug.es for Android app by GitHub (not all developers at GitHub use IntelliJ, personally I do - Eclipse is also used to work on this project).
The first step for smooth running is obviously to ensure that your project builds correctly using only plain Maven at the command line - although the question doesn't directly ask about this, I'd advise these pre-requisites as a bare minimum:
Java 6
Maven v3.0.3
android-maven-plugin v3.1.1
Android SDK r16 (if you downloaded your SDK before r15, you're probably better off nuking the entire thing and downloading it all again, as the directory layout has changed)
If you can mvn install the parent pom of your project, you're good to move on to actually working with it with IntelliJ.
If this is the first time opening the project with IntelliJ, you can still open it as a project, you just need to select the parent pom.xml file in the 'Open Project' dialog.
Ensure IntelliJ knows where the Java SDK is. IntelliJ, even though it's running on Java, doesn't auto-detect the location of the SDKs. You have to tell it. Go Project Structure, Platform Settings, SDKs and then edit the Java SDK if it's showing as red, giving it the path of your Java 6 SDK.
In the same Project Structure dialog window, set the Project SDK to the appropriate Android version, and under Project set the Project compiler output to whatever directory name you like - this value is required for doing a 'Make', but also overridden to by your submodules to sensiibly point to the Maven 'target' directories.
Double-check that all the Maven information has been parsed by IntelliJ. You should have a Maven Projects tab. Hit the Reimport All Maven Projects button (looks like two arrows chasing each other). If IntelliJ prompts you to enable Auto-Import, go for it. You should now have at least one module listed under the Maven Projects tab, more if you have an integration test project as well.
At this point, you should have a fairly meaningful IDE experience. Stuff that should work:
There should be no code underlined in red for no readily apparent reason.
All imports (whether from the Android SDK, Java, your own code or from apklibs) should be recognised. Note that apklib support only came in with late IntelliJ IDEA v10.5.
Refactor operations.
Force regenerate R.java file should correctly refresh the file under target/generated-sources/r/... - but this only seems to work if target/generated-sources/r is already set as a source path, ie has been generated by Maven, and imported by IntelliJ. The minimal command line alternative is to execute mvn android:generate-sources from the command line in the folder of the affected module.
Doing a 'Make' of the project within the IDE technically works, but again might fail for the same reason. I invoke all my builds using the mvn package or install at the command line.
Stuff that might not work:
Running individual integration tests from the IDE (dies with ClassNotFoundException: junit.textui.ResultPrinter)
If IntelliJ gets confused, the following steps will normally get you back on track:
mvn clean install on the command line
Hit the Reimport All Maven Projects button
Some advice:
Your Maven pom.xml files should be the source of truth for your project configuration. Minimise IntelliJ-specific configuration you do in the project settings- some of it will be liable to get wiped the next time settings are re-imported from the Maven POM - and try to avoid committing IntelliJ project files into source-control.
Hope that helps!
See Getting Started with the maven-android-plugin.
Here the command you can use to create an sampe working template with Maven structure:
mvn archetype:generate \
-DarchetypeArtifactId=android-with-test \
-DarchetypeGroupId=de.akquinet.android.archetypes \
-DarchetypeVersion=1.1.0 \
-DgroupId=com.foo.bar \
-DartifactId=my-android-project \
-Dpackage=com.foo.bar.android
BTW, IntelliJ has built in support for maven, so just open pom.xml from it - and everything will be ok.

Categories

Resources