I want to write files to hdfs present on a remote server and came across few examples like this and this. I have Cdh4.2.1 on my remote server and when from my code I try to do import org.apache.hadoop.conf.Configuration;, I get the following error:
Cannot resolve Configuration
My pom.xml looks like:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.4.1</version>
</dependency>
In this SO post, the pom.xml looks different and when I try to put those versions in my pom, the maven does not recognize it.
How can I resolve this issue?
Try using just the hadoop-client dependency and use cloudera specific version as you are using CDH like this:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.0.0-cdh4.2.1</version>
</dependency>
Also make sure you have the following repositories to resolve the jar dependencies:
<repository>
<id>maven-hadoop</id>
<name>Hadoop Releases</name>
<url>https://repository.cloudera.com/content/repositories/releases/</url>
</repository>
<repository>
<id>cloudera-repos</id>
<name>Cloudera Repos</name>
<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
</repository>
Related
I am trying to import a library in Maven which is Kotlin Multiplatform.
This is it's Github repo (does not actually matter much of course)
Point is, it says it can be imported in with this dependency for Gradle:
dependencies {
implementation("com.github.ajalt.colormath:colormath:2.0.0")
}
Obviously, just converting it to Maven does not work:
<dependencies>
...
<dependency>
<groupId>com.github.ajalt.colormath</groupId>
<artifactId>colormath</artifactId>
<version>2.0.0</version>
<type>jar</type>
</dependency>
</dependencies>
So I added it's pom to the project as this answer explains it:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.ajalt.colormath</groupId>
<artifactId>colormath</artifactId>
<version>2.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
This dependency is resolved (it can be only resolved as pom type. Then I add it as dependency:
<dependencies>
...
<dependency>
<groupId>com.github.ajalt.colormath</groupId>
<artifactId>colormath</artifactId>
<version>2.0.0</version>
<type>jar</type>
</dependency>
</dependencies>
It still cannot find it.
I also added the repo1, because I did not see where Maven was looking for this artifact:
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo1.maven.org/maven2</url>
</repository>
</repositories>
But still no success. I don't understand why it's not working.
The code can be found in the repo1, but Maven does not resolve it.
This must be a very simple thing I am not understanding here, please help.
The link to the Maven Central from GitHub points to a bare POM artifact, without any dependencies and/or attached JARs.
It looks like Kotlin MP uploads JVM-specific artifacts with a different artifactId - colormath-jvm in this case. Please check corresponding directory in the Maven Central.
I suggest using following dependency declaration in the POM:
<groupId>com.github.ajalt.colormath</groupId>
<artifactId>colormath-jvm</artifactId>
<version>2.0.0</version>
I am currently getting into Spigot Pugin developement and need to access GameProfile, because I need it for a plugin (Stuff for changing Skins). I'm using Eclipse.
Now, I've watched a whole ton of tutorials in which GameProfile was used, and all these tutorials just went for
import com.mojang.authlib.GameProfile;
or
import net.minecraft.util.SOMETHINGLONG.GameProfile
without needing to explain anything why this line is possible.
Here is a guy that had the same problem like me with the second command but apparently could solve it with the first one, so im trying to get this one running. https://www.spigotmc.org/threads/how-to-import-net-minecraft-util.252371/.
If I try to include stuff like this, I see com.google.common, com.oracle and com.sun but com.mojang is nowhere to be seen. I found it has to do something with the .jar files you add to your project, but I don't know how to get com.mojang... into the importable files.
To build up on SPY_me's answer, here is my solution if you're using Gradle:
repositories {
// ...
maven {
name = 'minecraft-repo'
url = 'https://libraries.minecraft.net/'
// this lets gradle know where to look for authlib
}
}
dependencies {
// ...
compile 'com.mojang:authlib:1.5.21'
// this adds the library to the project and the jar when you compile your project
}
If you want to download this library directly, here is the jar:
https://libraries.minecraft.net/com/mojang/authlib/1.5.21/authlib-1.5.21.jar
<repositories>
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>1.5.21</version>
<scope>provided</scope>
</dependency>
</dependencies>
Since you use Intellij i guess youre using Maven?
If so then paste this in your pom.yml:
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--Spigot API-->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!--Bukkit API-->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!--CraftBukkit API-->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.infinispan.InfinispanConstants;
import org.apache.camel.component.jackson.JacksonDataFormat;
import org.apache.camel.model.dataformat.JsonLibrary;
import uk.co.sammy.model.Collection;
public class InfinispanRoute extends RouteBuilder {
private JacksonDataFormat json = new JacksonDataFormat(Collection.class);
#Override
public void configure() throws Exception {
from("file:src/data?noop=true&include=.*.json")
.choice()
.when()
.jsonpath("$..CustInfo[?(#.firstName == 'Sammy')]").unmarshal(json)
.log("Got customer data for ${body.custInfo.firstName}")
.setHeader(InfinispanConstants.OPERATION, constant(InfinispanConstants.PUT_IF_ABSENT))
.setHeader(InfinispanConstants.KEY, simple("${body.custInfo.firstName}"))
.to("infinispan://localhost")
.marshal().json(JsonLibrary.Jackson)
.to("activemq:queue:incomingApplication", "activemq:queue:customerDetails");
from("activemq:queue:incomingApplication")
.setHeader(InfinispanConstants.OPERATION, constant(InfinispanConstants.GET))
.setHeader(InfinispanConstants.KEY, constant("${body.custInfo.firstName}"))
.to("infinispan://foo?cacheName=localCache")
.setBody(simple("${header.CamelInfinispanOperationResult}"))
.to("activemq:output");
}
}
My pom.xml looks like the below
<properties>
<activemq.version>5.14.1</activemq.version>
<camel.version>2.18.0</camel.version>
<infinispan.version>8.3.0.Final-redhat-1</infinispan.version>
<camel-jbossdatagrid.version>6.6.1.Final-redhat-1</camel-jbossdatagrid.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jsonpath</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-embedded</artifactId>
<version>${infinispan.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jbossdatagrid</artifactId>
<version>${camel-jbossdatagrid.version}</version>
</dependency>
<!--ActiveMQ -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
<version>${activemq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-pool</artifactId>
<version>${activemq.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.10</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-all</artifactId>
<version>5.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>fuse-release</id>
<name>jboss Release Repository</name>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://repo.fusesource.com/nexus/content/groups/public/</url>
</repository>
</repositories>
</project>
I have tried for three days to get this simple sample code to work with Infinispan using the REdhat getting started guide and downloaded the quickstart zip to run that but still won't work! I keep getting the error "cannot connect to foo:11222" or "pool not open" by Spring JMS then a warning about mixing Uber and Jars version. I started off using ehcache which was a pain to implement because of limited simple examples that show how to store, retrieve and clear a cache from rest calls etc. Now, I need this to work so I can easily migrate it to Openshift but, still won't work! Every time I restart the project, I get different errors. Please any help to step by step setup Infinispan to work using my above code will be SERIOUSLY appreciated. Thanks guys!
P.S: I've read through the Redhat data grid getting started page and followed their instructions before doing this as my last resort!!!
Using the "infinispan://localhost" uri format will try to connect to an Infinispan server. To use an embedded cache, you should use something like "infinispan://?cacheName=localCache"
I see a few errors in the example you have provided:
1st route:
You should set the value you want to put in the cache with InfinispanConstants.VALUE
2nd route:
You should use the same cache uses by the first route (i.e. same cache name)
You should use simple to set InfinispanConstants.KEY
I have the following JAR that my project needs so I added it to my pom.xml...
<dependency>
<groupId>org.reficio</groupId>
<artifactId>soap-builder</artifactId>
<version>1.0.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
</exclusion>
</exclusions>
</dependency>
But when I run Maven it tries to download from various repos and finally fails. It only creates a "lastUpdated" file whose contents are below..
http\://repository.jboss.org/nexus/content/groups/public-jboss/.lastUpdated=1392941827625
http\://www.terracotta.org/download/reflector/releases/.lastUpdated=1392941828195
Does anyone have any suggestions? Is this JAR simply not there anymore?
Thanks.
That artefact isn't in Maven Central (or other default repo) and so Maven won't find it automatically. The reficio/soap-ws page on Github explains:
soap-ws is not yet located in the central maven repo, thus you also have to add an additional repository to your config.
<repositories>
<repository>
<id>reficio</id>
<url>http://repo.reficio.org/maven/</url>
</repository>
</repositories>
I am looking for a maven repository that distributes jung2 packages. Unfortunetely I can not find any information on its location.
Update:
I have included the cental repository repo1.
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
But I still get an error: 10/4/10 1:31:57 PM CEST: Missing artifact net.sf.jung:jung2:jar:2.0.1:compile. I use Maven 3.0-SNAPSHOT on Mac osX.
Update2: Declaration of Jung2 dependency:
<dependency>
<groupId>net.sf.jung</groupId>
<artifactId>jung2</artifactId>
<version>2.0.1</version>
<type>pom</type>
</dependency>
After adding pom, there is no error message. Unfortunetely maven does not retrieve jars of jung2 modules.
[Solved] I have added also a dependency to jung-graph-impl and I can now use jung2 in my project:
<dependency>
<groupId>net.sf.jung</groupId>
<artifactId>jung-graph-impl</artifactId>
<version>2.0.1</version>
</dependency>
On repo1 :
<dependency>
<groupId>net.sf.jung</groupId>
<artifactId>jung2</artifactId>
<version>2.0.1</version>
</dependency>
Resources :
mvnrepository.com - Jung 2
You need to add this to the pom.xml. This work with maven central. No need to specify repository. But you can still use <url>http://maven.apache.org</url> directly in your pom.xml.
<dependency>
<groupId>net.sf.jung</groupId>
<artifactId>jung2</artifactId>
<version>2.0.1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>net.sf.jung</groupId>
<artifactId>jung-graph-impl</artifactId>
<version>2.0.1</version>
</dependency>
What is a maven repository url for jung2 (java graph framework)?
Answer: The Central Repository and its mirrors
But generally, you experiencied issue with dependencies.
To make your project buildable with Jung2 library, add specific modules (not jung2) to your pom.xml.
Example:
<dependency>
<groupId>net.sf.jung</groupId>
<artifactId>jung-graph-impl</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>net.sf.jung</groupId>
<artifactId>jung-algorithms</artifactId>
<version>2.0.1</version>
</dependency>
See the list of the modules http://mvnrepository.com/artifact/net.sf.jung
Adding the following:
<dependency>
<groupId>net.sf.jung</groupId>
<artifactId>jung2</artifactId>
<version>2.0.1</version>
<type>pom</type>
</dependency>
will not work in the way one could expect.
The reason is declaration of modules inside of profiles in pom.xml for jung2 artifact:
<profiles>
<profile>
<id>all</id>
<activation>
<property>
<name>all</name>
</property>
</activation>
<modules>
<module>jung-api</module>
<module>jung-graph-impl</module>
<module>jung-algorithms</module>
<module>jung-io</module>
<module>jung-visualization</module>
<module>jung-samples</module>
<module>jung-jai</module>
<module>jung-jai-samples</module>
<module>jung-3d</module>
<module>jung-3d-demos</module>
.............
</profiles>
Try Maven Repository or Maven Repository Browser.