0

First of all, sorry about my bad english.

Well, I've got a Minecraft server and, for those who don't know, it works with Java plugins. To create a plugin, it's needed to import a dependency(the jar that runs the server).

Since I need to modify those dependencies sometimes, I've got to keep them on my Dropbox, 'cause I work together with other developers.

I started to think about easier ways to achieve these goals. After a little research I found out about maven and I tried to use Artifactory and Nexus but I keep having a lot of problems with both: My IDE(just started to use Intellij) just doesn't find the .jar in the repository manager(also verified on Eclipse and NetBeans).

-------- QUESTION STARTS HERE --------

So, what's the best and simplest and easiest way to have those dependencies online(I've got some Linux CentOS servers to host them) in order to be able to import them and keep it updated(even if it's cached locally) without the need to work with the files?

3 Answers3

1

Artifactory or Nexus are good ways to do this.

You will need to configure your IDE(s) to point to your repository or adjust your Maven pom.xml files accordingly, as your repository is not the default one for Maven (called Maven Central, accessible from a web browser at http://search.maven.org/).

Here's a slightly edited excerpt from a pom.xml file I use:

<repositories>
    <repository>
        <id>fooco-repositories</id>
        <url>https://build1.fooco.com/nexus/content/groups/public/</url>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
        </snapshots>
    </repository>
</repositories>

See "Using the Internal Repository" on http://maven.apache.org/guides/introduction/introduction-to-repositories.html

cortextual
  • 43
  • 4
  • I tried using this both with maven and nexus, but on my IDE can't find the file, while I can access the repository in my browser – Ramon Gomes Mar 11 '15 at 00:49
  • You have IntelliJ right? Are you using Maven to build the project? If you import the project by pointing at its pom.xml, you should get proper Maven integration. Also, the URL for Maven to use may be slightly different than the one to use in your browser. – cortextual Mar 11 '15 at 15:13
  • I have artifactory installed on: `http://198.27.75.23:8081/artifactory/` and I want to use the .jar from `org/bukkit/bukkit/1.7.10/bukkit-1.7.10.jar` (plugins-release) and I have this [pom.xml](http://pastebin.com/wihu80yz) on my project . To me, it seems to be right, but when I try to use class from this dependencies, the Intellij can't identify them. – Ramon Gomes Mar 11 '15 at 18:42
0

The easiest way (not the best one) is to create a GIT repo right here for example - https://bitbucket.org/ and put your sources with all the JARs you need. To build you project you can use maven/gradle/ant+ivy.

Stephen L.
  • 509
  • 2
  • 14
  • but how to use maven from a bitbucket project? I found some tutorials but it just doesn't download the .jar in my project – Ramon Gomes Mar 11 '15 at 01:18
  • Bitbucket and Maven are two completely separate things. – Stephen L. Mar 11 '15 at 01:47
  • Yes, I got that. But what I don't get it's how can I build my project using maven in order to get the dependency from my bitbucket repository. – Ramon Gomes Mar 11 '15 at 18:46
  • Check out this link http://stackoverflow.com/questions/5692256/maven-best-way-of-linking-custom-external-jar-to-my-project. This how I included static JARs: ` com.mygroup artifactName 1.0 system ${basedir}/src/lib/somelib.jar ` – Stephen L. Mar 11 '15 at 23:09
0

It may be overkill - but as suggested above, setting up a nexus server is probably what you want.

Most likely the artifacts you're looking for won't vanish, but the key to the configuration is your "settings.xml" which typically you could find here:

"~/.m2/setting.xml"

Within there, you can have the "repositories" stanzas listed above plus the "servers" stanzas which allow you to set user/pass combos for deploying to different repos within.

If you're sharing across the internet, you're probably going to want to harden your nexus server, turn on/up auth, etc., beyond the scope of this posting...

EJC
  • 331
  • 2
  • 4
  • You mean, change the `settings.xml` from the server with nexus or the one in my computer? – Ramon Gomes Mar 11 '15 at 18:45
  • The one on your local computer (see the '~' - sorry *nix thing not sure what home dir is on/in windows). You'll want to make sure you're pointing at the proper repo, with the proper passwords and that's all configured in your local settings.xml. – EJC Mar 11 '15 at 21:31
  • So, every person that is going to use this repository needs to change their settings.xml? – Ramon Gomes Mar 12 '15 at 00:52
  • Yes - the stanzas outlined above are the only way to get maven to find your server. – EJC Mar 13 '15 at 01:59
  • May also want to checkout bintray – EJC Mar 13 '15 at 01:59