How to add craftbukkit to minecraft 1.19.3 plugin as dependency? - maven

I am trying to update a plugin [in 1.18.2] that I haven't written myself to minecraft 1.19.3.
However I am struggling with figuring out how to add craftbukkit as a dependency. I use maven and it seems to be unfindable for 1.19.3 in the mvnrepository.com. Further investigation led me to buildtools, which I ran and it did give me several folders and jar files, one of which is craftbukkit, spigot and bukkit.
However trying to add those jar files as dependencies also gave me errors of referencing to a non-existing file. Even though the file does exist in the resource folder of the project.
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>/GUIMarketplaceDirectory-master/src/main/resources/craftbukkit-1.19.3.jar</systemPath>
</dependency>
I also tried changing the path to start at my very source folder, but this didn't work. Any help would be appreciated.

I'm not sure you can add CraftBukkit as a dependency. It needs to be either bukkit, or spigot, since CraftBukkit is a server mod, not the plugin API. Here is code for a Spigot import.
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

Related

How can I use Maven locations in Eclipse Target files that come from custom repositories

I am trying to use a maven location in a Tycho build, that comes from a different repository than maven central. Below is the part of the definition that provides this on PDE. Tycho does not seem to honour the repository declaration and fails on resolution. Assuming I am observing this correctly, I have the following
Question: How can I hint Tycho to understand that these maven coordinates should be obtained from the associated repositories?
If this is not a current feature, but there is an issue, please comment as well, so this can be found and tracked.
<location includeDependencyScope="compile" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>com.github.amlorg</groupId>
<artifactId>amf-api-contract_2.12</artifactId>
<version>5.0.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.raml</groupId>
<artifactId>webapi-parser</artifactId>
<version>0.5.0</version>
<type>jar</type>
</dependency>
</dependencies>
<repositories>
<repository>
<id>mulesoft.releases</id>
<url>https://repository-master.mulesoft.org/nexus/content/repositories/releases</url>
</repository>
<repository>
<id>mulesoft.public</id>
<url>https://repository.mulesoft.org/nexus/content/repositories/public/</url>
</repository>
</repositories>
</location>

mvn- look for wrong url in maven repositories

When I run mvn package to compile a maven project it downloads the jar file from
wrong URLs. It adds org/dnosproject/ to the URL which is wrong.
Downloading: https://mvnrepository.com/artifact/io.github.dnos-project/dnos-lib-all/org/dnosproject/onos-port-protobuf/1.1.5/onos-port-protobuf-1.1.5.jar
<repositories>
<repository>
<id>dnos-lib-all</id>
<name>dnos-lib</name>
<url>https://mvnrepository.com/artifact/io.github.dnos-project/dnos-lib-all</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.github.dnos-project</groupId>
<artifactId>dnos-lib-all</artifactId>
<version>1.1.5</version>
</dependency>
The website mvnrepository.com is a kind of search engine across multiple real Maven repositories. If you look at the link you mentioned in your <repository/> configuration, you'll notice they list that dependency as available in "Central", in fact here. "Central" is configured by default, so you don't need a <repository/> configuration for this dependency. Instead, you just need the correct <dependency/> entry:
<dependency>
<groupId>io.github.dnos-project</groupId>
<artifactId>dnos-lib-all</artifactId>
<version>1.1.5</version>
</dependency>
You already had this in the snippet you posted, so just removing the <repository/> configuration should do the trick.

spring use library version not in the mvn repository

I'm trying to use spring-session-jdbc:2.0.0.RC2 which is not listed in https://mvnrepository.com/artifact/org.springframework.session/spring-session-jdbc/1.3.1.RELEASE
spring session github has newer version than mvnrepository.
How can I add the dependency of the new version in the pom.xml file?
To obtain dependencies that aren't on the central mvn repository, you must communicate to your project that you need it to point to an additional repository. In your case, this snippet, added to your pom, should do:
<repositories>
<repository>
<id>spring-milestone-repository</id>
<name></name>
<url>http://repo.spring.io/milestone/</url>
</repository>
</repositories>
After declaring this, you just add this to your dependencies, and it will be downloaded:
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-jdbc</artifactId>
<version>2.0.0.M2</version>
</dependency>

maven repository setup not working

I am referencing a repository in my POM.xml to add the ojdbc.jar to my project but Maven (I use the STS plugin) keeps telling me it can't find the jar.
I am showing below my repositories and jar dependency as defined in my POM.xml.
Anyone has an idea as to why the jar can't be found? Is my POM.xml not setup properly?
Note the vaadin repo works fine as the vaadin jars are correctly added to my project.
<repositories>
<repository>
<id>myrepo</id>
<url>http://mvnrepository.com/</url>
</repository>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>
and here is the dependency setup as defined at http://mvnrepository.com/artifact/ojdbc/ojdbc/14:
<dependencies>
<dependency>
<groupId>ojdbc</groupId>
<artifactId>ojdbc</artifactId>
<version>14</version>
</dependency>
</dependencies>
Anyone has an idea as to why the jar can't be found?
The jar can't be found due to license constraints.
Is my POM.xml not setup properly?
No it isn't, but adding to your pom the dependency:
<dependency>
<groupId>ojdbc</groupId>
<artifactId>ojdbc</artifactId>
<version>14</version>
</dependency>
you are able to download only the ojdbc14 pom because it has not a license limitation about distribution.
In order to make the above dependency works the jar has to be manually installed into your local Maven repository, without violating the license, by running:
mvn install:install-file -Dfile={Path_to_your_ojdbc.jar} -DgroupId=ojdbc
-DartifactId=ojdbc -Dversion=14 -Dpackaging=jar
eventually changing to the appropriate version number in -Dversion attribute, as correctly suggested by user1570577.
To use Oracle jdbc(OJDBC) driver with Maven, you can download the jar to your local machine and install it manually into your Maven local repository.
After downloading the jar install using the following command :
mvn install:install-file -Dfile={Path_to_your_ojdbc.jar} -DgroupId=com.oracle
-DartifactId=ojdbc -Dversion=14 -Dpackaging=jar . If the version is less than 14 change the appropriate version number in -Dversion attribute
Now you can set the dependency details in the pom file :
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>14</version>
</dependency>
</dependencies>
Oracle now has a maven repository: maven.oracle.com
See https://blogs.oracle.com/WebLogicServer/entry/weblogic_server_and_the_oracle

maven repository unavailable - richfaces

Update: As soon as I posted this, the repository URL began working. However, If you know how to address this, please enlighten me since I can see this happening again. Thank you all very much.
New to maven here.
I'm using RichFaces 4 and Netbeans 7
When I package the app gets:
http://download.java.net/maven/2/org/richfaces/richfaces-bom/4.0.0-SNAPSHOT/maven-metadata.xml
That URL is currently unavailable. As such, I'm not able to run my app because the build fails.
There must be a way around this and it's probably simple but my searches have come up with nothing.
Here are the relevent parts of my pom.xml
<repository>
<id>java-net</id>
<name>Java.net Maven Repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Setting this property using archetype-metadata.xml requiredPorperty
so that generated project uses correct version of richfaces.
-->
<org.richfaces.bom.version>4.0.0-SNAPSHOT</org.richfaces.bom.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>${org.richfaces.bom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
<dependencies>
I've tried setting up mirrors in my settings but it appears to be incomplete since it's not working for me. Here is my attempt at the mirror.
Note: I randomly selected the mirror so it's probably not what I want. Just trial and error to see what would happen.
<mirrors>
<mirror>
<id>RM</id>
<name>Java Net Mirror</name>
<url>http://repo1.maven.org/maven2</url>
<mirrorOf>java-net</mirrorOf>
</mirror>
Thanks in advance for any help you can sen my way.
You should definitly install a repository manager like Archiva, Nexus or Artifactory (http://www.jfrog.com/products.php) to avoid situations like this.
A Repository Manager will cache the external or self-generated maven artifacts for you and is really indispensible for any serious maven work.

Resources