+ All Categories
Home > Self Improvement > Maven basics (Android & IntelliJ)

Maven basics (Android & IntelliJ)

Date post: 06-May-2015
Category:
Upload: husyn-raj
View: 944 times
Download: 0 times
Share this document with a friend
Description:
A presentation I have given about Maven basic use for Android project
Popular Tags:
17
Maven Hussain Mansoor Folio3 (26 Feb 2014)
Transcript
Page 1: Maven basics (Android & IntelliJ)

MavenHussain Mansoor

Folio3 (26 Feb 2014)

Page 2: Maven basics (Android & IntelliJ)

Maven defined Declarative Dependencies

External modules

Build Order

Directories

Plug-ins

Build Management

Downloads dependencies and maintains local cache

Page 3: Maven basics (Android & IntelliJ)

Support Languages

Primarily Java

C#, Ruby, Scala

IDEs Eclipse, NetBeans, IntelliJ (by default), Jbuilder,

Jdeveloper, MyEclipse…

Page 4: Maven basics (Android & IntelliJ)

Build Life cycle process-resources

compile

process-test-resources

test-compile

test

package

install

deploy

Page 5: Maven basics (Android & IntelliJ)

<modelVersion>4.0.0</modelVersion>

<groupId>com.project</groupId>

<artifactId>Project</artifactId>

<version>1.1</version>

<packaging>apk</packaging>

<name>Project-Maven</name>

Page 6: Maven basics (Android & IntelliJ)

Dependencies

Scope compile, runtime, test, system, and provided

System path Local path, deprecated

groupId

artifactId

Packaging apk, jar, …

Page 7: Maven basics (Android & IntelliJ)

Tags defined• A universally unique identifier for a project. It is

normal to use a fully-qualified package name to distinguish it from other projects with a similar name (eg. org.apache.maven, com.project)

The identifier for this artifact that is unique within the group given by the group ID. An artifact is something that is either produced or used by a project. Examples of artifacts produced by Maven for a project include: JARs, source and binary distributions, and WARs.

E.g: android, mockito-all, junit

Page 8: Maven basics (Android & IntelliJ)

The central repository

Online central repository which hosts all the dependencies

Can search from group-id, artifact-id, version

Can also download jars, pom, etc

Page 9: Maven basics (Android & IntelliJ)

How to use? POM (pom.xml) file is the main file all the xml

data in it.

Dependent projects (if any) should also have pom

There are 3 major parts: Add dependencies

add dependencies with local path

add dependencies of custom jars (not in maven)

Page 10: Maven basics (Android & IntelliJ)

<build>

<plugins> <plugin>

<groupId>com.jayway.maven.plugins.android.generation2

</groupId>

<artifactId>android-maven-plugin</artifactId> <version>3.8.0</version>

<configuration>

<sdk> <platform>8</platform></sdk>

</configuration>

</plugin> </plugins>

</build>

Page 11: Maven basics (Android & IntelliJ)

How to add dependencies

<dependencies>

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.10</version>

<scope>test</scope>

</dependency>

</dependencies>

Page 12: Maven basics (Android & IntelliJ)

Local .jar file mvn install:install-file

-DgroupId=com.personagraph

-DartifactId=richinsights

-Dversion=1.4

-Dpackaging=jar -Dfile=libs/AndroidSDK-1.4-SNAPSHOT.jar

Page 13: Maven basics (Android & IntelliJ)

cmd mvn clean

mvn test

mvn compile

mvn deploy

Page 14: Maven basics (Android & IntelliJ)
Page 15: Maven basics (Android & IntelliJ)
Page 16: Maven basics (Android & IntelliJ)

Issues with Andriod Maven 3.1.1 is required with Android version

3.8.0

Google-services aren’t supported Create a local jar and include them

Page 17: Maven basics (Android & IntelliJ)

References http://maven.apache.org

http://en.wikipedia.org/wiki/Apache_Maven


Recommended