android - Maven does not fail from introduced compilation errors -
just moving android project on maven / jenkins , exploring build / compile / testing procedures.
issue: introduced simple compilation error in java code, when run mvn clean install package build success. it's when deploy app device crashes , fails.
is there wrong pom?
ps. have xxxxx'd out info. don't worry it.
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <parent> <groupid>xxxxx</groupid> <artifactid>xxxxxx</artifactid> <version>1.0.0</version> </parent> <groupid>xxxxx</groupid> <artifactid>xxxx</artifactid> <version>1.0.0</version> <packaging>apk</packaging> <name>android app</name> <dependencies> <dependency> <groupid>com.google.android</groupid> <artifactid>android</artifactid> <version>4.0.1.2</version> <scope>provided</scope> </dependency> <dependency> <groupid>com.actionbarsherlock</groupid> <artifactid>library</artifactid> <version>4.0.0</version> <type>apklib</type> </dependency> </dependencies> <build> <plugins> <plugin> <groupid>com.jayway.maven.plugins.android.generation2</groupid> <artifactid>android-maven-plugin</artifactid> <configuration> <androidmanifestfile>${project.basedir}/androidmanifest.xml</androidmanifestfile> <assetsdirectory>${project.basedir}/assets</assetsdirectory> <resourcedirectory>${project.basedir}/res</resourcedirectory> <nativelibrariesdirectory>${project.basedir}/src/main/native</nativelibrariesdirectory> <sdk> <platform>15</platform> <path>/users/aidenfry/android-sdks</path> </sdk> <undeploybeforedeploy>true</undeploybeforedeploy> </configuration> <extensions>true</extensions> </plugin> <plugin> <artifactid>maven-compiler-plugin</artifactid> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> </build> </project>
i suspect, reason you're not seeing error because maven didn't bother compiling classes in first place.
maven has various conventions, , 1 of them expects sourcecode located under src/main/java
.
i'm betting you've dropped above pom.xml
project root area , run mvn clean install
. maven happily run that, since you've left source files in default ide locations, maven skips on it. have in target directory , you'll see hasn't compiled classes in there you
you have 2 options:
- add somewhere inside
<build>
tags in above pom : ${basedir}/src - re-arrange source files follow
src/main/java
structure.
personally, i'd opt number 2.
p.s, there src/main/test
too, test classes should go there :)
you can read more configuration of pom file here
Comments
Post a Comment