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>
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>
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 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>
I'm trying to get sources added to my project. I manually added the below repo and included an atmosphere snapshot.
<repositories>
<!-- Added to get the Atmosphere 1.1.0-SNAPSHOT, can be removed when 1.1.0 is released -->
<repository>
<id>oss.sonatype.org-snapshot</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>1.1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
I went and downloaded the .jar from here but when I add it to the "libraries" section in my Project Structure it doesn't add it as a source, but adds it under Classes.
In debugging when viewing the interface of a class, I've used the quick "Attach sources..." option at the top of the editor and navigated to the .jar with no avail.
Maven doesn't find the sources, because there are no sources of that library in that Maven repository (which i think is quite common for snapshots of a library). I downloaded one of the jars, and they contain only class files, so i'm wondering, how you can see the sources even if you attach the jar manually.
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/