Is there a way to set maven up to make it possible to use 3rd party software?
I am trying to add the dependecy Spigot (minecraft server jar) to my project, but I want to work on it with some friends, and I want it too automatically update, if one of us decides to change the pom.xml.
So what I have next is:
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>
and
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.9-SNAPSHOT</version>
</dependency>
</dependencies>
but now I have to do something with maven, but I have no clue how?
Isn't there a way so it will automatically install it from that website I have put at the repository thing?
I liked the idea of maven, but if this is not possible it is kinda useless for what I want XD
I hope someone knows how it will automatically update it, because for all I have searched I got nothing :/
Try the below option, that might help you to update the snapshot on daily basis. Not sure what other options are, you might want to check on that sometime.
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
</repositories>
Related
I'm currently changing a docker image. The docker image creates a server that allows running some experiments. To adapt its functionality for my purpose, I have to change a class that is contained in a dependency jar file. In the pom.xml file, such jar dependency is downloaded with its dependencies from a nexus repository. I presume that a possible solution is to create a repository in the nexus repository (localhost) and then upload the jar file with its dependencies, right? Anyway, I would have no idea how I can do it. Below is the code concerning it.
Could someone help me up, please?
<repositories>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.liveontologies</groupId>
<artifactId>pinpointing-experiments</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
Yeah you're on the right track. What you're asking about is called a "deploy" in maven. So to deploy your jar generally you'll need to:
Create your nexus instance
Add your new repository to your pom file
Add the maven-deploy-plugin to your pom
Make your code changes
Deploy your jar with the mvn deploy command
Two good resources for lots of details on the steps and the exact content to add to your pom.
https://www.baeldung.com/maven-deploy-nexus
https://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html
I would like to import clojure libraries into a maven based java 11 application. The version of clojure used is mostly 1.8+, using boot to build. I can afford to be flexible on the language versions, but using boot for the clojure is a requirement.
I've done some reading into this but I have not been able to find any recent solutions, and non that use boot. Given that they're both JVM languages I hoped this wouldn't be too complicated but unsure where to begin.
Plain old Maven you should be enough to be able to retrieve any Clojure dependencies, since it supports adding different sources of packages. You just need to add another repo where the Clojure packages are hosted:
<repositories>
<repository> <!-- You probably have this already -->
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository><!-- You'll need to add this -->
<id>clojars</id>
<url>https://repo.clojars.org/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
To add more dependencies in Maven, you can search for the Clojure packages in Clojars or in Maven Repository. For instance, here's the entry in Maven repository for the clj-time library: https://mvnrepository.com/artifact/clj-time/clj-time/0.15.1
The relevant bit for adding that dependency in Maven would be:
<dependency>
<groupId>clj-time</groupId>
<artifactId>clj-time</artifactId>
<version>0.15.1</version>
</dependency>
Once you have the library available as a dependency, you can call it from Java as described on this guide: https://clojure.org/reference/java_interop#_calling_clojure_from_java
If you need to write a significant amount of code to use the libraries that you are interested, it might be advisable to write a Clojure function as the entry point rather than trying to write lots of Java code that call the Clojure library code.
I have a requirement where I have to work on different versions of a project. I am using maven-3.2.5 and right now I have only one local repository which I configured in my settings.xml like this
<localRepository>D:/Repo</localRepository>
and I have profile like this
<profile>
<id>RepositoryConfig</id>
<repositories>
<repository>
<id>public</id>
<url>http://bxus:8081</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<url>http://bxus:8081</url>
</pluginRepository>
</pluginRepositories>
</profile>
As I already told I have to work on different releases so I need to maintain the different code bases. I want to maintain separate local repository for each code base. One way is to create separate settings.xml for each code base but that method I don't want to adopt. I want to do this by one settings.xml file.
Please share your suggestions. I am using elipse as IDE.
You should use multiple branches to track the differences between the versions. In order to share the bulk of the code. See here an introduction to git branches.
If you are using multiple disconnected local repositories you will very likely end up in a nightmare. Because you will have to replicate the changes from one repo to another.
Using a single repo with multiple branches will allow you to share the code and maintain only the differences in their own separate branch.
If you need multiple local copies, you can clone the same repo in multiple locations but switch eac one to a different branch.
Then in each branch you are able to use a different maven configuration, if needed, like others have suggested. But the answer is to use multiple branches.
Use maven.repo.local :
1.(repo1) mvn -Dmaven.repo.local= /dir/myrepository1 -DRepositoryConfig1 clean install
2.(repo2) mvn -Dmaven.repo.local= /dir/myrepository2 -DRepositoryConfig2 clean install
And
<profile>
<id>RepositoryConfig1</id>
<repositories>
<repository>
<id>public</id>
<url>http://bxus:8081</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<url>http://bxus:8081</url>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>RepositoryConfig2</id>
<repositories>
<repository>
<id>public</id>
<url>http://bxus2:8081</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<url>http://bxus2:8081</url>
</pluginRepository>
</pluginRepositories>
</profile>
I am trying to get below dependency from jasper server.
<dependency>
<groupId>com.jaspersoft.jasperserver</groupId>
<artifactId>jasperserver-api</artifactId>
<version>6.0.1</version>
</dependency>
But i am getting below error
Missing artifact com.jaspersoft.jasperserver:jasperserver-api:jar:6.0.1
Here is my POM
<project ...>
<modelVersion>4.0.0</modelVersion>
....
<name>jasperProject</name>
<url>http://www.jaspersoft.com</url>
<dependencies>
<dependency>
<groupId>com.jaspersoft.jasperserver</groupId>
<artifactId>jasperserver-api</artifactId>
<version>6.0.1</version>
</dependency>
</dependencies>
</project>
With some simple googling you can get to this other answer on SO, where you can find a reference to this, which in term states you can add it like this:
<repository>
<id>JasperForge Maven Repository</id>
<!-- note: you need a <server> definition at bottom of file this file -->
<url>http://anonsvn:anonsvn#jasperforge.org/svn/repos/maven2</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
It also seems there's http://www.jasperforge.org/maven2/, which appears to be a non-browseable repository.
Another option is to put all required jars to a local maven repository. I know this is not the best solution, but it works, when you have no idea regarding correct Jasper public repository
The problem is that I'm trying to make somelike the helloworld with Activiti but I have an error here
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId>
<version>5.1</version>
</dependency>
the error is the following: 'Description Resource Path Location Type
Missing artifact org.activiti:activiti-engine:jar:5.1 pom.xml /IllMakeThisTestApp line 29 Maven Dependency Problem
Trying to resolve it I've found the following recomendation here: "The download contains all the libraries that you need to work with Activiti. But for developers that prefer to use Maven, add the following reposiory"
<repositories>
<repository>
<id>Alfresco Maven Repository</id>
<url>https://maven.alfresco.com/nexus/content/groups/public/</url>
</repository>
</repositories>
But where shall I place it? To the file called settings.ini placed in M2_HOME/conf? This file is full of comments with no any sign of repositories. So I have no idea how to do this and ask you for help
You should place that in your pom.xml - see the Maven reference on the subject:
<project xmlns="http://maven.apache.org/POM/4.0.0"...
...
<repositories>
<repository>
<id>Alfresco Maven Repository</id>
...
You will only need to tinker with the Maven config if you need to setup a mirror for the repo, eg. in case your organisation has it's own Nexus/other repo mirroring the outside "world".
Cheers,
You can place right under project. For example
<project>
....
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>
In default maven will try to download all the artifacts from maven central. You can add any number of added repositories using tag given above. Alfresco is yet another open maven repository.