how to install caldav4j using maven? - java

How can I install caldav4j from central maven repository?
I've added dependency as seen below to pom file, but package is not downloaded
<dependency>
<groupId>org.osaf</groupId>
<artifactId>caldav4j</artifactId>
<version>0.7</version>
</dependency>

Unfortunetly caldav4j is not in the central repository so you have to add external repository to your pom file. According to caldav4j FAQ repository address is at: https://caldav4j.googlecode.com/svn/maven/ so here is what you should add to pom file:
<repositories>
<repository>
<id>org.osaf.caldav4j</id>
<name>org.osaf.caldav4j</name>
<url>https://caldav4j.googlecode.com/svn/maven/</url>
</repository>
</repositories>

Related

How to make maven download dependencies from central repo. rather than downloading from remote company repo.?

So I thought of creating a spring boot project but on my company laptop. I downloaded the project from spring initializer and tried to execute on IntelliJ idea but got this error:
"java: package org.springframework.boot does not exist"
"java: cannot find symbol
symbol: class SpringBootApplication"
I ran maven clean and install cmds but still the same issue. Now I reckon this is happening bc maven is downloading dependencies from my remote company repository.
I remember saving a custom setting.xml file in .m2 folder which contains a custom repository.
So if I am right how can I make maven download from the central repo or solve this problem?
It sounds like you listed your own repository in your POM or settings.xml, like so:
<repositories>
<repository>
<id>vaadin-addons</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>
Doing so, without also listing Maven Central, will cause Maven to only attempt to resolve from your own repository. You must also list Maven Central, like so:
<repositories>
<repository>
<id>vaadin-addons</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories>
Maven checks repositories in the order they are specified. You cannot specify a repository per dependency, but you could create a new module with your dependencies and their specific repositories.

Could not find an artifact in central when using maven build a project

I'm totally new to Maven. I am building an Apache projects using Maven command: mvn clean package.
It showed build failure and give the following error message:
[ERROR] Failed to execute goal on project taverna-perspective-myexperiment: Could not
resolve dependencies for project org.apache.taverna.workbench:taverna-perspective-
myexperiment:bundle:3.1.0-incubating-SNAPSHOT: Could not find artifact
org.jdom:com.springsource.org.jdom:jar:1.1.0 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
It seems it needs a dependency org.jdom:com.springsource.org.jdom:jar:1.1.0 but it cannot find it. I searched this artifact in the internet and found a page giving the following maven configurations:
<dependency>
<groupId>org.jdom</groupId>
<artifactId>com.springsource.org.jdom</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
I checked the pom.xml and found the dependency for org.jdom is identical with the above. What should I do to fix it? Does it mean this artifact has been removed from the central? Is there any other sources we can set for it?
in page write note:
Note: this artifact is located at Spring Plugins repository (https://repo.spring.io/plugins-release/)
then you must add https://repo.spring.io/plugins-release/ to repositories in pom.xml file:
<repositories>
<repository>
<id>spring</id>
<name>Spring Repository</name>
<url>https://repo.spring.io/plugins-release/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>com.springsource.org.jdom</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>

Unable to add IBM db2jcc4 jar file through Maven

I am trying to access DB2 tables in a java project. I am able to access the tables when I manually added the jar files - db2jcc4.jar and db2jcc_license_cisuz.jar. No issues in accessing the tables.
But when I try to add these jar files through Maven, they won't add to the project.
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc4</artifactId>
<version>9.7.0.4</version>
</dependency>
Error Message - Missing artifact id.
Also, the latest db2jcc4.jar files (Version 11.1) are not present in Maven repository. Is there any other place I can access it from?
You have to download the right driver from IBM.
http://www-01.ibm.com/support/docview.wss?uid=swg21363866
Then install it to your local maven repository
http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html
As written in maven central repository the artifact is in another repo.
Add it to your pom and it will work.
<repositories>
<repository>
<id>Alfresco</id>
<name>Alfresco</name>
<url>https://artifacts.alfresco.com/nexus/content/repositories/public/</url>
</repository>
</repositories>
Assuming that , using share drive is the option to go.
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>licences</artifactId>
<version>0.7</version> <!-- Adjust this properly -->
<scope>system</scope>
<systemPath>R:\JDBC drivers\IBM DB2_db2_2.2.0.v20130525_0720\db2jcc_license_cisuz.jar</systemPath>
</dependency>
According to maven central repository the artifact is in another repository. Include these two in your pom.xml and it should work:
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc4</artifactId>
<version>10.1</version>
</dependency>
<repositories>
<repository>
<id>com.ibm.db2.jcc</id>
<url>https://artifacts.alfresco.com/nexus/content/repositories/public/</url>
</repository>
</repositories>

Maven tries to fetch shrinkwrap-bom from maven central, instead of configured repository

I am trying to build my maven project using Maven version 3.3.9 and a custom maven repository.
Building the project with Maven 3.1.0, it runs, downloads the dependencies and passes the tests.
After removing all local dependencies and upgrading Maven to 3.3.9, I get the following error while in the download phase:
failed to execute goal on project ... could not resolve dependencies ...
failed to collect dependencies at org.hibernate:hibernate-validator:5.2.4.Final:
failed to read artifact descriptor for org.hibernate:hibernate-validator:jar:5.2.4.Final:
could not transfer artifact org.jboss.shrinkwrap:shrinkwrap-bom.pom:1.2.2 from/to central (...)
Unknown host repo.maven.apache.org
Note again, that I am using a custom repository, not Maven Central.
But it works for the older version of Maven, so settings.xml is configured for my repository and the artifact does exist there.
Also, other dependencies do successfully download, it's just this dependency.
Why is Maven still trying to fetch from Maven Central regardless of my repository settings?
I had the same issue.
Our setup uses Nexus 3 repository manager. Maven Central is set up as a proxy repo in Nexus.
I have made the mistake to list central in the repositories part of settings.xml
<repositories>
...
<repository>
<id>central</id>
<url>http://<MY_NEXUS_HOST>:8081/repository/maven-central/</url>
</repository>
</repositories>
This was working for most of the dependencies. However it wasn't working for org.jboss.shrinkwrap:shrinkwrap-bom. Only this one.
The resolution was to specify Maven Central as a mirror:
<mirrors>
<mirror>
<id>central-proxy</id>
<name>central-proxy</name>
<url>http://<MY_NEXUS_HOST>:8081/repository/maven-central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
The problem is transitive dependencies with scope import.
I solved it for hibernate-validator version 6.0.13.Final by adding the following dependencies to my pom.xml:
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-bom</artifactId>
<version>1.2.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-bom</artifactId>
<version>2.2.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-bom</artifactId>
<version>2.0.0-alpha-8</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Issue on the Maven bugtracker:
https://issues.apache.org/jira/browse/MNG-6397
They promise to fix it in Maven version 3.6.3.
As an addition to Sergey comment - just want to mention that given dependencies should be placed inside dependencyManagement tag
SandorRacz's advice to create a mirror worked for me as well. Thanks!!
So while building I was getting the following error in my error logs:
[ERROR] Non-resolvable import POM: Failure to transfer org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.2 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.2 from/to central (http://repo.maven.apache.org/maven2): HTTPS Required (501) # org.jboss.arquillian:arquillian-bom:1.1.10.Final,
For the sake of clarity, here is how my settings.xml looked like after creating the mirror. (I hope it saves somebody's time)
<profiles>
<profile>
<id>nexus</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<url>http://repo.maven.apache.org/maven2/</url>
<id>central-repo</id>
<layout>default</layout>
</repository>
</repositories>
</profile>
</profiles>
<mirrors>
<mirror>
<id>central-proxy</id>
<name>central-proxy</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
<mirrorOf>central-repo</mirrorOf>
</mirror>
</mirrors>

where is " <groupId>org.glassfish.embedded</groupId>" repository here?

I want to use <groupId>org.glassfish.embedded</groupId> in my dependencies. What repository should I use?
I don't know what you want to use but the groupId org.glassfish.embedded looks pretty old.
I suggest to check the more recent maven coordinates that have been published with the release of GlassFish 3.0.1 and to use the Nexus repository for GlassFish:
<repository>
<id>java.net</id>
<name>GlassFish Maven Repository</name>
<url>http://maven.glassfish.org/content/groups/glassfish</url>
</repository>
Since version 3.1.2, glassfish artifacts are in Maven Central, so you don't need any special repository.
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.2</version>
</dependency>
http://download.java.net/maven/glassfish/org/glassfish/embedded/ ?
Add the respository to your pom.xml
<repository>
<id>glassfish.java.net</id>
<name>Glassfish repository</name>
<url>http://download.java.net/maven/glassfish</url>
<layout>legacy</layout>
</repository>
What artifact do you want though?
Maybe this will help: From What is the official Maven repository for Embedded GlassFish? : http://download.java.net/maven/glassfish/org/glassfish/extras/glassfish-embedded-all/3.1.1/

Categories