Add feed4j dependency in pom.xml - java

I cannot add a dependency in pom.xml for feed4j.jar
When I select a dependency for feed4j I get feed4junit but not the feed4j.
When I add a dependency in pom.xml
<dependency>
<groupId>feed4j</groupId>
<artifactId>feed4j</artifactId>
<version>1.0</version>
</dependency>
I get an error
Missing artifact feed4j:feed4j:jar:1.0
As a result when I try mvn clean install I get an error
package it.sauronsoftware.feed4j does not exist
Any help please.

Feed4j is not in the Maven central repository. You have several options:
Use a Maven repository which has the feed4j artifact available. You can set up your own Nexus or Artifactory.
Include the jar file in your project and use the maven system scope (see this SO question for an example how to use it)
Install the dependency manually in your local Maven repository. Here is a short tutorial how to do that.

Eventually, i found the answer here but feed4j is not included in the repository.jboss that's why I used the pentaho-releases.

Related

Maven Dependency missing artifact : jhotdraw

I am currently working on a Java project using Maven. In my pom.xml I am getting this error.
Missing artifact org.jhotdraw:jhotdraw:jar:6.0b1
I have added this dependency
<dependency>
<groupId>org.jhotdraw</groupId>
<artifactId>jhotdraw</artifactId>
<version>7.6.0</version>
</dependency>
to my pom.xml. But still the error is same.
Can someone help me?
That version of org.jhotdraw.jhotdraw does not exist on Maven Repository, the last version available on Maven Repository is 7.4.1
Either you have made an error as to the version or group id (I see there is a 7.6.0 package under org.opentcs.thirdparty.jhotdraw, but don't know if it's the same). Alternatively, you may have to manually download and install that package, check out...
How to include custom library into maven local repository

How to refer to a project from innersource?

I have a java-maven project working on my STS. The thing is that I want to create my own spring-boot starter and include it as a maven dependency in the pom.xml file of my project. The thing is that this starter will be located in an innersource repository and I don't know what information I need to put in the pom.xml file to refer to that one in innersource and not to other one. Maybe is it possible to specify the URL of the repository or what?
Thanks you so much for your help!
The thing is that I want to create my own spring-boot starter and
include it as a maven dependency in the pom.xml file of my project.
By reading this I think that what you are looking for is how to create a dependency, that you can easily include it at any of your projects.
By this you can have a local maven repository or push it to a remote repository (like most of all dependencies), what is important is wherever you push it is available to be downloaded.
If you go by the local version you can use a maven/gradle plugin to package your jar and publish it. You will need to specify a couple of properties like groupId, artifactId and version
https://docs.gradle.org/current/userguide/publishing_maven.html
with the groupId, artifactId and version you will be able to include it in your project like
<dependency>
<groupId>org.myorg</groupId>
<artifactId>my-artifact</artifactId>
<version>0.0.1</version>
</dependency>
if this is from a maven local dependency don't forget to include maven local as part of your repositories.
https://www.baeldung.com/maven-local-repository
Check these articles, it will help you.
https://maven.apache.org/guides/introduction/introduction-to-repositories.html
Create local maven repository

Intellij Maven dependency not found (sqlite-jdbc)

IntelliJ Maven pom.xml I get the following message:
Dependency org.xerial:sqlite-jdbc:3.8.11.1 not found.
How can I fix my problem? This is the only dependency in my pom.xml which doesn't work.
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.8.11.1</version>
</dependency>
after testing in a new Maven Test Project, it works now in my main projec. Thank
Check correctness artifact properties as group artifact and version, if they correct this mean your artifact is not in maven central repo you need manually add new repository in you pom.xml where this artifact present. If you artifact in maven central try to load them manually if you use maven not bundled in intellij install
-> open console in idea with alt + f12 then type mvn dependency:resolve
update
your artifact in central repo, https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc/3.8.11.1
Sometimes i meet this bug in Idea (Idea does not see this dependency because it does not indexed by Idea or something like this, version of artifact highlight red but it is only idea deal) add manually this dependency or try to recheck (clear caches) and all will be work.

add external jar to our dependency

There is a jar file lets say "abc.jar" which maven dependency does not exist(ie created a jar by using java command of own classes). I want to add this jar as maven dependency so that at build time it will automatically copy that jar in lib folder as like other maven dependency. how i will do. please help .
Add it as a dependency with a system scope. See the docs here.
However, rather than adding it as a system dependency it might be better to mavenize the jar itself, then you can build and install it into your dependency management system.
Also, see this question: Can I add jars to maven 2 build classpath without installing them?
You can use the systemPath attribute in the dependency tag in the POM file of your project.
In your pom.xml, use the following snippet corresponding to abc.jar:
<dependencies>
<!-- Other dependencies -->
<dependency>
<groupId>abc</groupId>
<artifactId>x</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>{path_to_abc.jar}</systemPath>
</dependency>
</dependencies>
The scope parameter corresponding to this artifact must be set to system, for the artifact to be picked up from the specified systemPath.
Hope this helps!
A normal maven dependency is always resolved by looking into a repository. So you must put your JAR file into a repository.
You could install your JAR into your local repository. Have a look at the install plugin. The install-file goal is your friend.
If other developers also need this JAR (because they are working with the same project), they either need to install it locally too, or - better - you deploy the JAR to a remote repository. Have a look at the deploy plugin. Here the deploy-file goal is your friend. For deploying artifacts, you need a repository manager like Nexus or Artifactory.
However, a dependency could also have the system scope (look at the other answers).

Add a dependency in Maven

How do I take a jar file that I have and add it to the dependency system in maven 2? I will be the maintainer of this dependency and my code needs this jar in the class path so that it will compile.
You'll have to do this in two steps:
1. Give your JAR a groupId, artifactId and version and add it to your repository.
If you don't have an internal repository, and you're just trying to add your JAR to your local repository, you can install it as follows, using any arbitrary groupId/artifactIds:
mvn install:install-file -DgroupId=com.stackoverflow... -DartifactId=yourartifactid... -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/jarfile
You can also deploy it to your internal repository if you have one, and want to make this available to other developers in your organization. I just use my repository's web based interface to add artifacts, but you should be able to accomplish the same thing using mvn deploy:deploy-file ....
2. Update dependent projects to reference this JAR.
Then update the dependency in the pom.xml of the projects that use the JAR by adding the following to the element:
<dependencies>
...
<dependency>
<groupId>com.stackoverflow...</groupId>
<artifactId>artifactId...</artifactId>
<version>1.0</version>
</dependency>
...
</dependencies>
You can also specify a dependency not in a maven repository. Could be usefull when no central maven repository for your team exist or if you have a CI server
<dependency>
<groupId>com.stackoverflow</groupId>
<artifactId>commons-utils</artifactId>
<version>1.3</version>
<scope>system</scope>
<systemPath>${basedir}/lib/commons-utils.jar</systemPath>
</dependency>
Actually, on investigating this, I think all these answers are incorrect. Your question is misleading because of our level of understanding of maven. And I say our because I'm just getting introduced to maven.
In Eclipse, when you want to add a jar file to your project, normally you download the jar manually and then drop it into the lib directory. With maven, you don't do it this way. Here's what you do:
Go to mvnrepository
Search for the library you want to add
Copy the dependency statement into your pom.xml
rebuild via mvn
Now, maven will connect and download the jar along with the list of dependencies, and automatically resolve any additional dependencies that jar may have had. So if the jar also needed commons-logging, that will be downloaded as well.
I'd do this:
add the dependency as you like in your pom:
<dependency>
<groupId>com.stackoverflow...</groupId>
<artifactId>artifactId...</artifactId>
<version>1.0</version>
</dependency>
run mvn install it will try to download the jar and fail. On the process, it
will give you the complete command of installing the jar with the error message. Copy that command and run it! easy huh?!
I'll assume that you're asking how to push a dependency out to a "well-known repository," and not simply asking how to update your POM.
If yes, then this is what you want to read.
And for anyone looking to set up an internal repository server, look here (half of the problem with using Maven 2 is finding the docs)

Categories