Building Android project in Jenkins "requires Maven version 3.1.1" - android

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.

Related

What is the purpose of gradle-wrapper.properties in Android Studio?

I have updated my gradle-wrapper.properties to 2.10 from 2.8. But I want to know that what its purpose in Android Studio. As we didn't see any gradle-wrapper properties in eclipse.
Gradle Wrapper is a type batch or shell script that downloads and automatically configures Gradle to execute tasks. Imagine that you want to run a Gradle build, well you need to download and install Gradle in your computer, so this concept allows is to distribute our project and build configurations with no need to have Gradle installed.
Also their official gradle webiste says :
Most tools require installation on your computer before you can use
them. If the installation is easy, you may think that’s fine. But it
can be an unnecessary burden on the users of the build. Equally
importantly, will the user install the right version of the tool for
the build? What if they’re building an old version of the software?
The Gradle Wrapper solves both these problems and is the preferred way
of starting a Gradle build.

android-maven-plugin:3.8.0 requires Maven version 3.1.1

I have created an android project using maven archetype. When I try
clean install from Intellij Idea, I get the following error.
The plugin com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0 requires Maven version 3.1.1
When I try the same thing from a terminal like $ mvn clean install, it works fine. When I change the android-maven-plugin to 3.6.0, it works fine in Idea.
My maven version is 3.1.1
So, I do not understand why I am even facing this problem with Intellij Idea when I have the android-maven-plugin as 3.8.0. Any pointers?
I fixed the error by configuring my IDE to point to right maven version. By default it was pointing to M2_HOME. In Intellij Idea, I did it like
File->Settings->Maven
and changing the Maven Home Directory to point my 3.1.1 installation path.
One way to find your maven home and version would be
$ mvn --version
You will get something like,
Maven home: /usr/share/apache-maven-3.1.1

Android with Maven and IntelliJ

For the past 3 weeks I've played heavily with Android Maven build process. For the most part I find it a much better experience than Eclipse but have a few questions I'd like answered:
Is there a way to make Eclipse work with APKLIB files without importing the project into Eclipse?
Using Maven is there a way to push the APK to the device without uninstalling the application? Using mvn android:deploy uninstalls the APK and installs a new one.
I've yet to get the Android JavaDoc to work well in IntelliJ, any solutions?
Does IntelliJ work well with the NDK?
I'm open to any tips in the best build process for the platform as it will be what I use moving forward. Should I go Ant or Maven?
APKLIB support in Eclipse is still not fully there. Use m2eclipse and m2eandroid and maybe help with patches for m2eandroid.
mvn android:deploy can install an apk to the device (or all attached devices). mvn android:run can start it. undeploy and redeploy work as well.
the maven android sdk deployer can also deploy the source and it should hook up fine with intellij and the maven integration
NDK and Intellij - not for writing code but the build process via Maven will work just fine also in Intellij..
Last but not least.. you should definitely NOT go ant. Either Maven or use the new, upcoming Gradle build. Don't waste time on the old (and soon to be deprecated) Ant build and all its problems.

Integrating maven project in Android project

I am building an Android application, and I want to use certain functionalities that are supplied in a Maven project.
What is the easiest way to use this maven project in my Android project? I have never worked with Maven so I prefer to deal with it as little as possible.
I tried exporting the maven project into a jar using eclipse and then using it to my android's project build path, but when I run it I get java.lang.NoClassDefFoundError: info.bliki.api.User.
So what would be the easiest way to use this Maven project in my Android project?
Well, i guess you're just interested in the resulting artifact, then you should be able to just run in the command line (you need to have a version of Maven running though)
mvn install
which compiles and build the project. You'll get a local copy directly written into ~/.m2/ ... this is where all maven artifacts are installed to . You could then just grab the resulting jar (if it is one) or link directly to the resulting artifact.

How to disable m2e build in Eclipse Indigo?

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.

Categories

Resources