Read an excel file using Apache Camel - excel

I am trying to read an Excel file using Apache Camel. For that I have found that we can use the CSV component:
https://camel.apache.org/components/3.14.x/dataformats/csv-dataformat.html
For that I have created a simple route which reads a XLSX file from a folder. Then I am trying to print the content of of that Excel file and write to another folder, but the contents of the file are not getting printed. The route is as below:
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.dataformat.csv.CsvDataFormat;
import org.apache.commons.csv.CSVFormat;
import org.springframework.stereotype.Component;
#Component
public class MyRoute extends RouteBuilder {
public void configure() {
CsvDataFormat csv = new CsvDataFormat();
csv.setFormat(CSVFormat.EXCEL);
from("file://C://work//ei01//source")
.unmarshal(csv)
.log("Reached ${body}")
.marshal(csv)
.to("file://C://work//ei01//destination?fileName=test.xlsx");
}
}
The pom.xml is as below:
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>sprng-boot-camel-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sprng-boot-camel-demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>3.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-csv-starter</artifactId>
<version>3.14.1</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Can you please suggest me what I am doing wrong here?

I suppose you try to read a real Excel file (.xlsx). That does not work with the CSV data format.
The CSVFormat.EXCEL format is to read CSV files (.csv) exported from Excel. Because the CSV format is done quite different from product to product, Camel supports multiple "well-known" CSV formats. One of them is CSVFormat.EXCEL.
To read the native Excel format (I think it is a ZIP file that contains XML files), you need a library like Apache POI.

Related

How to generate Cucumber Report HTML locally

I want to generate Cucumber HTML Report Locally, but not able to do so. I have followed lot of YT videos and blogs but they are using #CucumberOptions which is deprecated and also requires Runner. I am new with Cucumber, I followed Cucumber 10 min tutorial.
POM.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.hertzbit</groupId>
<artifactId>third-party-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-bom</artifactId>
<version>7.5.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.9.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>5.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit-platform-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
</plugin>
</plugins>
</build>
This is RunCucumberTest File
import org.junit.platform.suite.api.*;
import static io.cucumber.junit.platform.engine.Constants.*;
#Suite
#IncludeEngines("cucumber")
#SelectClasspathResource("thirdpartytest")
#ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty")
public class RunCucumberTest {
}
So far whichever blog post I went through none of them are talking about Cucumber 7. Also when I use cucumber.publish.enabled=true in src/test/resources/junit-platform.properties or src/test/resources/cucumber.properties, then also I am not able to push report to https://reports.cucumber.io, My preference is to create the reports locally.

Unable to resolve class com.atlassian.jira.component.ComponentAccessor

I am trying to run a Groovy script on IntelliJ IDEA, the Groovy script I am trying to run is called UsersCount.groovy, it looks like this
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserManager
def userManager = ComponentAccessor.getUserManager() as UserManager
def message = "My instance contains ${userManager.totalUserCount} user(s)."
log.warn(message)
When I run this code, I get the following error message
"C:\Program Files\Zulu\zulu-8\bin\java.exe" "-Dtools.jar=C:\Program Files\Zulu\zulu-8\lib\tools.jar" -Dgroovy.home=C:\Users\mouh\.m2\repository\org\codehaus\groovy\groovy-all\2.4.6 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\lib\idea_rt.jar=59917:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\mouh\.m2\repository\org\codehaus\groovy\groovy-all\2.4.6\groovy-all-2.4.6.jar org.codehaus.groovy.tools.GroovyStarter --main groovy.ui.GroovyMain --classpath .;C:\Users\mouh\IdeaProjects\scriptrunner-samples\jira\target\classes --encoding=UTF-8 C:\Users\mouh\IdeaProjects\scriptrunner-samples\jira\src\main\resources\UsersCount.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
C:\Users\mouh\IdeaProjects\scriptrunner-samples\jira\src\main\resources\UsersCount.groovy: 2: unable to resolve class com.atlassian.jira.user.util.UserManager
# line 2, column 1.
import com.atlassian.jira.user.util.UserManager
^
C:\Users\mouh\IdeaProjects\scriptrunner-samples\jira\src\main\resources\UsersCount.groovy: 1: unable to resolve class com.atlassian.jira.component.ComponentAccessor
# line 1, column 1.
import com.atlassian.jira.component.ComponentAccessor
^
2 errors
How can I fix this error and make sure that the imports are resolved? I made sure to include the dependency for com.atlassian.jira in my pom.xml file. My pom.xml file looks like this
<?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>
<!-- I added the parent pom.xml, which does all the magic. I took this pom.xml from the ScriptRunner sample plugin -->
<parent>
<groupId>com.adaptavist.pom</groupId>
<artifactId>scriptrunner-jira-standard</artifactId>
<version>10</version>
<relativePath/>
</parent>
<groupId>ru.matveev.alexey.scriptrunner</groupId>
<artifactId>scriptrunner-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>scriptrunner-plugin</name>
<description>This is the ru.matveev.alexey.scriptrunner:scriptrunner-plugin plugin for Atlassian JIRA.</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<!-- I excluded a couple of dependencies from the dependency below, because the plugin did not want to start for ScriptRunner versions higher than 5.3.0 -->
<dependency>
<groupId>com.onresolve.jira.groovy</groupId>
<artifactId>groovyrunner</artifactId>
<version>${scriptrunner.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.onresolve.scriptrunner.platform</groupId>
<artifactId>scriptrunner-test-libraries-jira</artifactId>
</exclusion>
<exclusion>
<groupId>jndi</groupId>
<artifactId>jndi</artifactId>
</exclusion>
<exclusion>
<groupId>jta</groupId>
<artifactId>jta</artifactId>
</exclusion>
<exclusion>
<groupId>is.origo.jira</groupId>
<artifactId>tempo-plugin</artifactId>
</exclusion>
<exclusion>
<groupId>com.tempoplugin</groupId>
<artifactId>tempo-core</artifactId>
</exclusion>
<exclusion>
<groupId>groovyrunner</groupId>
<artifactId>test</artifactId>
</exclusion>
<exclusion>
<groupId>com.atlassian.plugin.automation</groupId>
<artifactId>automation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<!-- I increased JVM memory, because Jira 7.9.0 does not want to run with the default settings -->
<jvmArgs>-Xms512M -Xmx1g</jvmArgs>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<applications>
<!-- I added Jira Software to the plugin because I want Jira Software to start on the atlas-run command. -->
<application>
<applicationKey>jira-software</applicationKey>
<version>${jira.version}</version>
</application>
<!-- I added Jira Service Desk to the plugin because I want Jira Service Desk to start on the atlas-run command. -->
<application>
<applicationKey>jira-servicedesk</applicationKey>
<version>${jira.servicedesk.application.version}</version>
</application>
</applications>
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<Export-Package>
ru.matveev.alexey.scriptrunner.api,
</Export-Package>
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*
</Import-Package>
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>7.9.0</jira.version>
<jira.servicedesk.application.version>3.12.0</jira.servicedesk.application.version>
<scriptrunner.version>5.3.9</scriptrunner.version>
<amps.version>6.3.6</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.0.0</atlassian.spring.scanner.version>
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<testkit.version>6.3.11</testkit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<!-- This is required to find the parent pom and ScriptRunner dependencies -->
<repository>
<id>adaptavist-external</id>
<url>https://nexus.adaptavist.com/content/repositories/external</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
</repository>
</repositories>
</project>
You should specify the path to the Atlassian SDK maven:
Go to Settings (Alt+Ctrl+S) -> Build, Execution, Deployment -> Build -> Maven
In the "Maven home path" set the path to the location where your installed Atlassian SDK is and its direct child maven sub-folder.
In the User settings file checkbox the Override option and menu below specify the path to the "settings.xml" file inside the maven sub-folder of the path above
Click Save to save the changes of the IDEA settings
As your local Maven is not configured to see Atlassian repos.

Betamax with Spring Boot throws Illegal use of nonvirtual function call

I'm trying to setup a simple test in Groovy with Spock using Betamax:
class BetaMaxSpockTest extends Specification {
#Rule
public Recorder recorder = new Recorder()
#Betamax(tape = "some_tape")
def 'You shall pass'() {
expect:
true
}
}
I'm also using Spring Boot so I have spring-boot-starter-parent as my parent in pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.6.RELEASE</version>
</parent>
When I run above test I'm getting this error:
java.lang.VerifyError: (class: co/freeside/betamax/proxy/jetty/BetamaxProxy, method: super$3$getBean signature: (Ljava/lang/Class;)Ljava/lang/Object;) Illegal use of nonvirtual function call
at java.lang.Class.forName(Class.java:264)
at co.freeside.betamax.proxy.jetty.ProxyServer.start(ProxyServer.groovy:47)
at co.freeside.betamax.Recorder.startProxy(Recorder.groovy:198)
at co.freeside.betamax.Recorder.withTape(Recorder.groovy:167)
at co.freeside.betamax.Recorder$1.evaluate(Recorder.groovy:185)
at org.spockframework.runtime.extension.builtin.MethodRuleInterceptor.intercept(MethodRuleInterceptor.java:40)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:84)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
at org.spockframework.util.ReflectionUtil.invokeMethod
Without Spring Boot on path it works fine. Looks like some versions problem. Anyone had similar issue?
My full pom.xml:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.6.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<!--plugins versions-->
<maven.compiler.plugin.version>3.3</maven.compiler.plugin.version>
<!--settings-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!--Spring Boot-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--Spock Testing-->
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<scope>test</scope>
</dependency>
<!--Groovy Testing-->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<scope>test</scope>
</dependency>
<!--Betamax Http Mocks-->
<dependency>
<groupId>co.freeside</groupId>
<artifactId>betamax</artifactId>
<version>1.1.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<--...-->
</pluginManagement>
</build>
</project>
There are a couple things you can do to fix this. The first is that you can make the code in question #CompileStatic (probably the Spec in your case) which often resolves the issue, but this is not always desireable (and does not always work).
The other thing you can do is add -Xverify:none to your java command line options (wherever you would specify them for your environment). This will turn off the verification, which is what is causing the error.
From what I have read about this issue when I originally ran into it, they are planning on turning off verification by default in the next Java version. This generally occurs with Groovy or other libraries that do a lot of bytecode manipulation under the covers (asm is another).
I have found the solution. The problem was in wrong versions of jetty and httpclient. BetaMax requires versions shown below, while Spring's parent pom declares much newer versions.
Adding this two lines to properties in my pom.xml solved the issue:
<jetty.version>7.3.1.v20110307</jetty.version>
<httpclient.version>4.2.1</httpclient.version>
Anyway, thanks for your help!

Maven ANTLR generating wrong directory

I have the following pom.xml:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>db.project</groupId>
<artifactId>engine</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<antlr4.visitor>true</antlr4.visitor>
<antlr4.listener>true</antlr4.listener>
</properties>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.0</version>
<configuration>
<sourceDirectory>src</sourceDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Normally, I use ANLTR 4 plugin which is described in this link : https://github.com/jknack/antlr4ide . But I want to use maven now, when I update my grammar in com.db.project directory, parser and lexer are generated in both default package (i.e., src/default package) and src/com/db/project/ twice, whereas I only want my lexer and parser in src/com/db/project/ directory. (including both .g4 file and java files in the same package)
How can I change this via pom.xml?
Simple change 4.0 to 4.2 in your antlr4-maven-plugin's version tag.
Note that the plugin will recursively scan src/main/antlr4 for .g4 grammar files. If your grammar resides in src/main/antlr4/com/company then the package of your generated parser/lexer files will be com.company.
Here's a small template project to get you started, in case you need it:
https://github.com/bkiers/antlr4-template

ActionBarSherlock maven dependency

I have been trying to add the ActionbarSherlock maven dependency to my project using the
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>library</artifactId>
<version>4.2.0</version>
</dependency>
in my pom.xml file. Now this works except for my styles.xml file, where it does not seem to the abs styles, but everything else works fine ? What am i doing wrong. Below is the full pom.xml
<?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>
<groupId>com.xyz</groupId>
<artifactId>abc</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>abc Android Application</name>
<dependencies>
<dependency>
<groupId>org.springframework.android</groupId>
<artifactId>spring-android-rest-template</artifactId>
<version>1.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.8</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.0.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<platform>16</platform>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
</project>
ActionBarSherlock is a library project which means you need to add a <type>apklib</type> to the Maven dependency declaration.
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>4.2.0</version>
<type>apklib</type>
</dependency>
(Note that I've also changed the artifactId to 'actionbarsherlock')
In order to do this, you need to have the android-maven-plugin referenced with <extensions>true</extensions>. It looks you have this requirement completed already from your pasted pom.xml.

Resources