SonarQube - mvn sonar : sonar - NoSuchElementException - java

I have a project on SonarQube but when I try to update it with the follow command in the terminal it gets me the this error :
[ERROR] NoSuchElementException
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
I have searched online but apparently nobody knows the answer, so I thought I'd give it a try.
I have the following project structure:
Project name
Dal
SharedModel
WebsocketClient
WebsocketServer
So in total I have 4 modules. My main pom.xml 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/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.1.8.RELEASE</version>
</parent>
<groupId>myproject.nl</groupId>
<artifactId>myproject</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>websocketserver</module>
<module>websocketsclient</module>
<module>sharedmodel</module>
<module>Dal</module>
</modules>
<name>PartieKo</name>
<dependencies>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<!-- JUnit 5 -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

Your command is wrong:
mvn sonar : sonar // WRONG
Remove the spacers between sonar and sonar and add the Sonar server address:
mvn sonar:sonar -Dsonar.host.url=https://mysonarserver:9000
The sonar server configuration can also be configured in the pom.xml file (add in the properties section)
<properties>
...
<sonar.host.url>https://mysonarserver:9000</sonar.host.url>
</properties>

Command mvn sonar scanner on windows
mvn sonar:sonar `
"-Dsonar.projectKey=xxxxx" `
"-Dsonar.host.url=http://local:9000" `
"-Dsonar.login=xxxxxxxxx"
Linux
After adding project on sonar console manualy,sonar will give you the next command.
mvn sonar:sonar \
"-Dsonar.projectKey=xxxxx" \
"-Dsonar.host.url=http://localhost:9000" \
"-Dsonar.login=xxxxxxxxx"
You can also put url/host/login in pom file or env config.

Related

How to run Coverage on SonarCloud using Maven Dependency instead of Source Code

I'm writing some Test Cases for Apache JCS. For University purposes i need to integrate these tests with Maven and SonarCloud, in particular i need to run tests without having in local the JCS source code, but "importing" the project via Maven Dependency.
Configuring the pom.xml and the sonar-project.properties the project build correctly and the Test Cases are correctly executed. However, i need also the Coverage metric, but it's stuck to 0%.
I think that the solution lies in configuring the pom.xml so that coverage runs not only on local code, but also by resolving dependencies. Any Idea?
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>danilo.dellorco</groupId>
<artifactId>jcsTests</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>jcsTests</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
</dependency>
<dependency>
<groupId>jcs</groupId>
<artifactId>jcs</artifactId>
<version>1.3</version>
<!-- Remove bug of jdbc-sdtext error -->
<exclusions>
<exclusion>
<artifactId>jdbc-stdext</artifactId>
<groupId>javax.sql</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<!-- Specifico la cartella dove si trovano i Test JUnit -->
<testSourceDirectory>src/test/</testSourceDirectory>
<!-- Dichiaro la cartella contenente i file di configurazioni dei test -->
<sourceDirectory>src/test/resources</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit4</artifactId>
<version>2.22.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
sonar-project.properties
sonar.projectKey=danilo-dellorco_jcstests
sonar.projectName=jcsTests
sonar.links.homepage=https://github.com/danilo-dellorco/jcsTests
sonar.links.ci=https://travis-ci.com/github/danilo-dellorco/jcsTests
sonar.links.scm=https://github.com/danilo-dellorco/jcsTests
sonar.links.issue=https://github.com/danilo-dellorco/jcsTests/issues
sonar.host.url=https://sonarcloud.io
sonar.organization=danilo-dellorco
sonar.sources=src
sonar.language=java
sonar.java.source=13
sonar.java.binaries=.
# Debug
sonar.verbose=true
travis.yml
language: java
jdk:
- openjdk13
os:
- linux
dist:
- debian
addons:
sonarcloud:
organization: "danilo-dellorco"
token: "##############################"
script:
# This command analyzes only the pom.xml file
#- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.projectKey=danilo-dellorco_jcsTests
- mvn test
- sonar-scanner
Test Example
import org.apache.jcs.JCS;
import org.apache.jcs.access.exception.CacheException;
...
#RunWith(Parameterized.class)
#Category(JUnitTest.class)
public class JCSRemovalSimpleConcurrentTest {
private int count;
private static JCS jcs;
public JCSRemovalSimpleConcurrentTest(int count){
this.count = count;
}
#BeforeClass
public static void configure() throws CacheException {
JCS.setConfigFilename("/TestRemoval.ccf");
jcs = JCS.getInstance("testCache1");
}
...

Maven JavaFX Run error org.openjfx:javafx-maven-plugin:0.0.6

I created a maven project and added a JavaFX project to it. I made the following pom.xml
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>SEF-PROJ</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<javafx.version>16</javafx.version>
<javafx.maven.plugin.version>0.0.6</javafx.maven.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>${maven.compiler.release}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>${javafx.maven.plugin.version}</version>
<configuration>
<executable>/home/mrsaiba/.jdks/corretto-1.8.0_292/jre</executable>
<mainClass>src.sampe.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
When I run the mvn javafx:run, I got the error
Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.6:run (default-cli) on project SEF-PROJ: Error
I googled it for days, but nothing useful showed up. I am using Java 8 and JavaFX 16(I don't want use a newer version of Java). I set up the JAVA_HOME with the path to the Java 8 jre.
In Maven 3 if you just had a failed download and have fixed it (e.g. by uploading the jar to a repository) it will cache the failure.
To force a refresh add -U to the command line.
Source: https://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Cannot create custom BOM. Project build fails with Non-resolvable import POM: Could not find artifact

I am using eclipse mars with embedded maven (version 3.3.9) and i am facing a problem i cannot understand in order to resolve it. I have been trying to create a JMS related "library" that some other projects can use in their pom under their dependencyManagement section (in other words following the "BOM" pattern). However, when the created BOM is pulled in the dependencyManagement section of the corresponding project that is supposed to use it, the dependencies specified are pulled in, but the project build itself (mvn clean install) fails with an error shown further down.
The structure i used is the following:
A "jms-dependencies-BOM" project (packaged as pom), which includes as a submodule a "jms-dependencies-parent" project (again packaged as pom) which in turn inherits from the "jms-dependencies-BOM" project. Additionally, there is a "amqdeps" submodule of the aforementioned "jms-dependencies-parent" project (packaged as a jar). The "amqdeps" submodule also inherits from the "jms-dependencies-parent" project. The corresponding project that is supposed to import the "jms-dependencies-BOM" pom in its dependencyManagement section and use the "amqdeps" dependency in the dependencies section is "TestIntegrator".
Although it does sound like a duplicate i am not sure it is. My error message is a bit different (no mention of an incorrect relative path for example as in other questions).Now i have tried everything i could think of, purging the whole .m2/repository folder, tried to build the TestIntegrator project from the cli using even a slightly different maven version (3.2) than the embedded one in eclipse. Basically i have tried everything suggested by similar questions asked,all to the same result. I suppose it is something with the way i have structured the BOM hierarchy of the projects (the relative paths perhaps, although the compiler does not complain about it) but i do not understand it enough.
"jms-dependencies-BOM" pom
<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>jms-dependencies-BOM</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<amqdeps.version>0.0.1-SNAPSHOT</amqdeps.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>amqdeps</artifactId>
<version>${amqdeps.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>jms-dependencies-parent</module>
</modules>
</project>
The "jms-dependencies-parent" pom
<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>
<parent>
<groupId>com.test</groupId>
<artifactId>jms-dependencies-BOM</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<groupId>com.test</groupId>
<artifactId>jms-dependencies-parent</artifactId>
<packaging>pom</packaging>
<properties>
<activemq.version>5.13.1</activemq.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
<version>${activemq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-openwire-legacy</artifactId>
<version>${activemq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
<version>${activemq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-jaas</artifactId>
<version>${activemq.version}</version>
</dependency>
<--MORE DEPENDENCIES TRUNCATED FOR CLARITY-->
</dependencies>
</dependencyManagement>
<modules>
<module>amqdeps</module>
</modules>
</project>
The "amqdeps" pom
<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>
<parent>
<groupId>com.test</groupId>
<artifactId>jms-dependencies-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>amqdeps</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-openwire-legacy</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
</dependency>
<--MORE DEPENDENCIES TRUNCATED FOR CLARITY-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
</plugins>
</build>
</project>
and finally the "TestIntegrator" pom
<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>TestIntegrator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<spring.framework.version>5.1.4.RELEASE</spring.framework.version>
<jms-dependencies-BOM.version>0.0.1.SNAPSHOT</jms-dependencies-BOM.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring.framework.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.test</groupId>
<artifactId>jms-dependencies-BOM</artifactId>
<version>${jms-dependencies-BOM.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
</dependency>
<dependency>
<groupId>com.test</groupId>
<artifactId>amqdeps</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
</plugins>
</build>
</project>
When i do a mvn clean install in the parent project (i.e. "jms-dependencies-BOM") everything is build and i can see the corresponding poms for the "jms-dependencies-BOM",
"jms-dependencies-parent" and "amqdeps" (and the jar for the amqdeps project as well) being installed in the corresponding .m2/repository folder under directories of com/test/... . In addition i can see the dependencies listed in the amqdeps project being pulled in the TestIntegrator project, with no errors showing anywhere. However, every time i try to perform a mvn clean install from the IDE in the TestIntegrator project it fails with the following error:
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Could not find artifact com.test:jms-dependencies-BOM:pom:0.0.1.SNAPSHOT # line 43, column 16
[ERROR] 'dependencies.dependency.version' for com.test:amqdeps:jar is missing. # line 104, column 14
#
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.test:IgniteIntegrator:0.0.1-SNAPSHOT (C:\Users\matrix\eclipse-mars\workspace\TestIntegrator\pom.xml) has 2 errors
[ERROR] Non-resolvable import POM: Could not find artifact com.test:jms-dependencies-BOM:pom:0.0.1.SNAPSHOT # line 43, column 16 -> [Help 2]
[ERROR] 'dependencies.dependency.version' for com.test:amqdeps:jar is missing. # line 104, column 14
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
Can anyone help me out please?
The reason for this particular error seems to be a simple typo in the version string. Your are trying to import
<jms-dependencies-BOM.version>0.0.1.SNAPSHOT</jms-dependencies-BOM.version>
while the project version is actually
<version>0.0.1-SNAPSHOT</version>
Note the . vs - difference.
That said, I do believe you should read more about Project Inheritance vs Project Aggregation and make sure you understand the details of how reactor builds work. Then perhaps you may want to re-think how you structure your modules. I'm not judging you (may be you have your good reasons to do what you do), but at first look it seams your multi-module structure is somewhat messy and thus fragile.

execute goal mvn-failsafe-plugin: (failsafe-integration-tests) project x: suiteXmlFiles is configured, but there is no TestNG dependency

i am using maven failsafe plugin to execute the integration test cases along with cobertura plugin.
in the configuration of failsafe plugin, i have given suiteXmlFile which has all the integration tests
however, when run the following command , i am getting error
command is : mvn cobertura:cobertura-integration -DskipITs=false
and error is :
Failed to execute goal maven-failsafe-plugin:2.17:integration-test (failsafe-integration-tests) on project xx: suiteXmlFiles is configured, but there is no TestNG dependency
here is the snippet from pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>/home/adam/coberturaint/reporting/src/test/resources/testng/it-test.xml</suiteXmlFile>
</suiteXmlFiles>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.8</version>
</dependency>
</dependencies>
</dependencyManagement>
</configuration>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.8</version>
</dependency>
</dependencies>
</plugin>
i am using fail-safe plugin version : 2.17
i have mentioned the dependency of testng everywhere, but still i am getting dependency error
please suggest
regards
You need to go a different way cause the messages it already.
<?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>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.8</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>/home/adam/coberturaint/reporting/src/test/resources/testng/it-test.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Apart from that you need to call maven like this:
mvn verify
to run the integration-test phase. If you call Maven like this:
mvn cobertura:cobertura-integration
You have no life cycle which will not run the integration tests.
You should prevent using absolute paths in your pom file as you do with your suite file. The question is on the other hand why you need a suite file. In TestNG usually you don't need one.

Creating apklibs with maven and IntelliJ

I'm creating a apklib from sliding menu because I couldn't find any maven repository. The problem is that when I try from intellij, It imports the library but doesn't add the dependencies to sliding menu library and I have to add it manually.
<?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.slidingmenu</groupId>
<artifactId>library</artifactId>
<version>1.2</version>
<type>apklib</type>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
</dependency>
<dependency>
<groupId>com.google.android.maps</groupId>
<artifactId>maps</artifactId>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v13</artifactId>
<version>r12</version>
</dependency>
<dependency>
<groupId>com.github.rtyley</groupId>
<artifactId>roboguice-sherlock</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.roboguice</groupId>
<artifactId>roboguice</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>4.2.0</version>
<type>apklib</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<nativeLibrariesDirectory>ignored</nativeLibrariesDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
I create the zip, according to the instructions on maven plugin and then I push it to ~/.m2 with this command:
mvn org.apache.maven.plugins:maven-install-plugin:2.4:install-file -DgroupId=com.slidingmenu -DartifactId=library -Dfile=sliding-menu.apklib -Dversion=1.2 -Dpackaging=apklib
You need to install com.slidingmenu in your local repository with mvn clean install instead of install:install-file
mvn clean install will put all the meta-data and the dependencies required by maven in your local repository (i.e. ~/.m2/repository).
In your apk, specify the artifact com.slidingmenu as a dependency of type apklib
I hope it will solve your problems.

Categories

Resources