Maven aws-java-sdk and aws-android-sdk conflict - java

In my maven project, I need to use aws-java-sdk-athena which has aws-java-sdk-core as a dependency. However for authentication, I have no other choices but using a provided artifact which has aws-android-sdk-core as a dependency. The problem is both of them have the com.amazonaws.http.ExecutionContext class with that exact same name. But they have different methods, etc..
I tried excluding one of them but then one of them goes off which mean those classes were used. I'm very frustrated now as it is nearly impossible to repackage one of these artifacts to change the package name in it.
<dependencies>
<!-- This dependency requires aws-java-sdk-core 1.11.292 -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-athena</artifactId>
<version>1.11.292</version>
</dependency>
<!-- This dependency requires aws-android-sdk-core 2.6.16 -->
<dependency>
<groupId>work.commons</groupId>
<artifactId>work-commons-authentication</artifactId>
<version>${authz.version}</version>
</dependency>
<dependencies>
<repositories>
<repository>
<id>in.house</id>
<name>nexus</name>
<url>http://work.name.com/content/groups/public/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
At runtime, I got that exception:
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: com.amazonaws.http.ExecutionContext.setContextUserAgent(Ljava/lang/String;)
That because of both java-sdk and android-sdk have the exact class com.amazonaws.http.ExecutionContext but the class in java-sdk doesn't have setContextUserAgent method. If I change the order of dependencies, the Athena connection function broke.

Solved the problem by using a stand-alone JAR file of Athena JDBC driver. All the required classes are still there with different package name. So I didn't need to install the whole aws-java-sdk-core.

Related

Unable to add IBM db2jcc4 jar file through Maven

I am trying to access DB2 tables in a java project. I am able to access the tables when I manually added the jar files - db2jcc4.jar and db2jcc_license_cisuz.jar. No issues in accessing the tables.
But when I try to add these jar files through Maven, they won't add to the project.
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc4</artifactId>
<version>9.7.0.4</version>
</dependency>
Error Message - Missing artifact id.
Also, the latest db2jcc4.jar files (Version 11.1) are not present in Maven repository. Is there any other place I can access it from?
You have to download the right driver from IBM.
http://www-01.ibm.com/support/docview.wss?uid=swg21363866
Then install it to your local maven repository
http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html
As written in maven central repository the artifact is in another repo.
Add it to your pom and it will work.
<repositories>
<repository>
<id>Alfresco</id>
<name>Alfresco</name>
<url>https://artifacts.alfresco.com/nexus/content/repositories/public/</url>
</repository>
</repositories>
Assuming that , using share drive is the option to go.
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>licences</artifactId>
<version>0.7</version> <!-- Adjust this properly -->
<scope>system</scope>
<systemPath>R:\JDBC drivers\IBM DB2_db2_2.2.0.v20130525_0720\db2jcc_license_cisuz.jar</systemPath>
</dependency>
According to maven central repository the artifact is in another repository. Include these two in your pom.xml and it should work:
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc4</artifactId>
<version>10.1</version>
</dependency>
<repositories>
<repository>
<id>com.ibm.db2.jcc</id>
<url>https://artifacts.alfresco.com/nexus/content/repositories/public/</url>
</repository>
</repositories>

can't add maven dependency - apache poi

I created this maven project in Eclipse on my mac. The following two artifacts are in my pom. No problem on MAC.
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.14</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.14</version>
</dependency>
However when I recently moved the code to Eclipse on my PC I got this weird error "Missing artifact org.apache.poi:poi:jar:3.14". And it points to both the dependency block and the first line of pom (see screenshot) . Updated project many times and it did not help.
I have set up two repositories, one public and one institutional.
<repositories>
<repository>
<id>JBoss repository</id>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>repo</name>
<url>http://risdevtool01p.mdanderson.edu:8081/artifactory/repo</url>
</repository>
</repositories>
When I do "mvn clean install -U", it looks like it is trying to download poi and poi-ooxml from two different repositories.
Downloading:http://repository.jboss.org/nexus/content/groups/public/org/apache/poi/poi-ooxml-schemas/3.14/poi-ooxml-schemas-3.14.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/poi/poi/3.14/poi-3.14.jar
Downloading: http://risdevtool01p.mdanderson.edu:8081/artifactory/repo/org/apache/poi/poi/3.14/poi-3.14.jar
Downloading: http://risdevtool01p.mdanderson.edu:8081/artifactory/repo/org/apache/poi/poi-ooxml-schemas/3.14/poi-ooxml-schemas-3.14.jar
The problem is in the nexus of JBoss, the artifact is not properly deleted indeed we had the version in the list of available versions but the version is not available at the expected location which is http://repository.jboss.org/nexus/content/groups/public/org/apache/poi/poi/3.14/
404 - Path /org/apache/poi/poi/3.14/ not found in group repository "Public Repository Group" [id=public].
Path /org/apache/poi/poi/3.14/ not found in group repository "Public Repository Group" [id=public].
But, obviously they've just removed this version properly indeed now this version is no more part of the available versions as you can see here http://repository.jboss.org/nexus/content/groups/public/org/apache/poi/poi/ such that if you remove it from your local repository and try again with a command of type mvn clean install, it will work

How include MapDB in a GWT project

I'm using this Guide for adding MapDb to my project.
i'm trying to make a simple user registration but i don't understand where and how i can put the lib inside my project!
Where include this code
<dependency>
<groupId>org.mapdb</groupId>
<artifactId>mapdb</artifactId>
<version>VERSION</version>
</dependency>
and this code
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.mapdb</groupId>
<artifactId>mapdb</artifactId>
<version>VERSION</version>
</dependency>
</dependencies>
i'm new with GWT and MapDB and if someone can tell me how put the libraries of MapDB with all steps it's can be very grateful!
After that i manage the data store/retrieve in the server gwt application?
While this is a very old question, I'll reply in case it's still helpful to you.
The XML configuration code you've quoted above should be inserted in a Maven POM file. Maven is a configuration management tool for Java-based projects.
If you aren't using or don't want to start using Maven, you can download the jar from Maven central and add it manually to your project.

Vaadin Maven Repo and Artifactory

I developed an java web-app application with spring and vaadin, in this application, I used some addons like easyuploads and wizards-for-vaadin. Then i added the following configuration in my pom.xml.
<dependency>
<groupId>org.vaadin.addon</groupId>
<artifactId>easyuploads</artifactId>
<version>7.0.1</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>wizards-for-vaadin</artifactId>
<version>1.1.0</version>
</dependency>
<!-- Add-On Repository -->
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>
Now I'm installing artifactory (for the first time) like tool of repository managment and I thought to add a remote repository for the vaadin-addons. But this not work:
How can I solve it ?
Is this the correct way?
Their repository is not browsable, that's why you get the 404 on testing. You can disregard the error, if should resolve the artifacts just fine (assuming the coordinates are correct).
We found out by accident that there seems to exist a browsable Nexus repository now: http://vaadin.com/nexus/content/repositories/vaadin-addons/
We have successfully included it as a proxy repository in our local Nexus installation.

Can't find the "org.eclipse.persistence" Maven dependency

I installed Eclipse Helios with the m2eclipse maven plugin.
I want to create an application using JPA. So, what I do is: New > Maven Project then I select the maven default archetype.
The problem is that I want to add the "org.eclipse.persistence" dependency that I can't find.
Where is it? Can we add it manually? Should I update a sort of "repository"?
Then, is it the right archetype that I'm using?
EclipseLink is not available in Maven central repository, you need to add its repository manually. For example, to use the "full" version of EclipseLink 2.0 (you didn't mention the artifact you're looking for):
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
...
</dependency>
<dependencies>
...
<repositories>
<repository>
<id>EclipseLink Repo</id>
<url>http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo</url>
</repository>
...
</repositories>
This is documented in the EclipseLink/Maven page.
Regarding the archetype you're using, it's impossible to answer without more details on the kind of project you want to create. And anyway, you can always modify the POM after the facts.
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
...
<repositories>
<repository>
<url>http://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
You can check below link. I found eclipse JARs on this link.
However, no idea about how to add it on Nexus.
http://dev.nightlabs.org/maven-repository/repo/

Categories