Is apache commons-lang 3.0 available in any maven repo? - java

commons-lang 3.0 is still beta, but can it be found in some maven repository (I couldn't)

Adding repository (POM):
<repositories>
<repository>
<id>snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots</url>
</repository>
</repositories>
Adding dependency:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

You can use the snapshots at http://repository.apache.org/snapshots/org/apache/commons/commons-lang3/3.0-SNAPSHOT/.
Update: It's been released so it is in the central maven repository now.

Adding:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
Caused the module to be automatically downloaded, but from http://repo.maven.apache.org, not Maven Central

Related

Unable to run maven command from command prompt but executes sucessfully through eclipse

I have added all dependencies(my project ,junit,etc) and surefire plugin. so it is executing successfully in eclipse but when run through command prompt it throws error. below is the attached screenshot. and the pom.xml file . embeeded maven settings in eclipse works.maven location is also getting recognised from command prompt
BUILD FAILURE ERROR
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.selenium</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.53.1</version>
</dependency>
-->
<!-- https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver -->
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.mail/javax.mail -->
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.uncommons/reportng -->
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.4</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.inject/guice -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- Dependency for POI API -->
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<testFailureIgnore> false </testFailureIgnore>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/runner/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
From the error, it says maven try to download a depedency jar from this remote maven center repository: https://repo.maven.apache.org/maven2/
Because this repository is a SSL website, you need to install its certification to pass the auth. And Maven run by JDK, so you need to import the certication into JDK Security Store.
The reason why you can pass in eclipse is eclipse use a different settings.xml as run maven command, maybe eclipse not use the SSL repository.
There are two options:
1) Don't use SSL maven remote repository, specify a HTTP repository:http://repo1.maven.org/maven2 in your manve settings.xml, like below:
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>securecentral</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>securecentral</id>
<!--Override the repository (and pluginRepository) "central" from the
Maven Super POM -->
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
2) Import certification in JDK Security Store
find the step to import in this post:
Problems using Maven and SSL behind proxy
I think you are using two different maven,usually eclipse comes with its own maven version. You can verify you are using same Maven installation in eclipse and from command prompt.
You can verify maven installation in eclipse by going to
Preference--> Maven--> Installation.
From command prompt, check for Maven home/M2 home.

org.wso2.carbon.identity.oauth.stub artifact not found

I have a project that is using these dependencies:
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.identity.oauth.stub</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
<version>4.2.0</version>
</dependency>
It seems that these dependencies are not available anymore.
Do you know any other versions of them?
WSO2 artifacts are not available on Maven Central.
You need to add the following repository :
<repositories>
<repository>
<id>wso2-maven2-repository</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public</url>
</repository>
</repositories>

Eclipse / Maven Project is missing required library / Missing artifact

I get errors like the following in Eclipse using Maven:
Missing artifact org.eclipse:swt:jar:3.7.
Project 'davmail' is missing required library: '/home/buzz-dee/.m2/repository/org/eclipse/swt/3.7.0/swt-3.7.0.jar'
Most libraries are found as you can see in the above image, but some not. But the files are in the right place.:
ls ~/.m2/repository/org/eclipse/swt/3.7.0/
swt-3.7.0.jar.lastUpdated swt-3.7.0.pom.lastUpdated
This is a partial pom.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>davmail</groupId>
<artifactId>davmail</artifactId>
<packaging>jar</packaging>
<version>4.6.1</version>
<name>DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange Gateway</name>
<organization>
<name>Mickaƫl Guessant</name>
</organization>
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>xwiki</id>
<layout>default</layout>
<url>http://maven.xwiki.org/externals</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-webdav</artifactId>
<version>2.4.3</version>
<exclusions>
<exclusion>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr-commons</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.3</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>swt</artifactId>
<version>3.7.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlcleaner</groupId>
<artifactId>htmlcleaner</artifactId>
<version>2.2</version>
</dependency>
<!-- included in Java 1.6, needed with Java 1.5 -->
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.samba.jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.14</version>
</dependency>
<dependency>
<groupId>net.freeutils.charset</groupId>
<artifactId>jcharset</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.boris.winrun4j</groupId>
<artifactId>winrun4j</artifactId>
<version>0.4.5</version>
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<url>http://repository.apache.org/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</build>
</project>
What could be wrong?
According to this DavMail page, org.eclipse:swt:jar:3.7.0 is an optional dependency. It isn't in mavenCentral, you could probably hunt it down from some other repository, but the simplest thing to do would be to remove that dependency from your pom and rebuild using -U
Alternatively, as discussed here, you can download the jar from here and install it to your local .m2 repo using the install command:
mvn install:install-file -DgroupId=org.eclipse -DartifactId=swt -Dversion=3.7.0 -Dpackaging=jar -Dfile=lib/swt-3.7-win32-x86.jar
Please note though, that this is a temporary fix, that will have to be repeated on every machine you want to build this project on. That kinda defeats the point of offloading dependency management to a tool like Maven. I would still prefer removing swt as a dependency from your project if that works.
Disregard previous answer.
Maven central doesn't have version 3.7.0 for org.eclipse.swt. The latest version according to maven central is 3.3.0. You can see that in the link here. mvnrepository.com doesn't have it either.
You could try using the 3.3.0 version or you could try manually adding into your source folder, but, again, the latest version available on their website is 4.4.2

Maven Error in pom.xml using spring template

i am getting the following error in mi maven pom.xml on a spring template project
"Description Resource Path Location Type
ArtifactDescriptorException: Failed to read artifact descriptor for org.slf4j:slf4j-api:jar:1.5.6: ArtifactResolutionException: Failure to transfer org.slf4j:slf4j-api:pom:1.5.6 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.slf4j:slf4j-api:pom:1.5.6 from/to central (http://repo.maven.apache.org/maven2): C:\Users\muhsin.HIFX.m2\repository\org\slf4j\slf4j-api\1.5.6\slf4j-api-1.5.6.pom.ahc0570cfa3a1934af5 (The system cannot find the file specified) pom.xml /sample line 1 Maven Dependency Problem"
my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples.spring</groupId>
<artifactId>spring-jpa-utility</artifactId>
<version>1.0.0.CI-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Spring JPA Utility</name>
<url>http://www.springframework.org</url>
<description>
<![CDATA[This project is a minimal jar utility with Spring configuration for JPA usage.]]>
</description>
<properties>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
<spring.framework.version>3.0.6.RELEASE</spring.framework.version>
</properties>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.0.Final</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.framework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.156</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<!-- <pluginRepositories>
<pluginRepository>
<id>Codehaus</id>
<url>http://repository.codehaus.org/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>org.jboss.repository.releases</id>
<name>JBoss Maven Release Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<distributionManagement>
<downloadUrl>http://www.springframework.org/download</downloadUrl>
<site>
<id>staging</id>
<url>file:///${user.dir}/target/staging/org.springframework.batch.archetype/${pom.artifactId}</url>
</site>
<repository>
<id>spring-release</id>
<name>Spring Release Repository</name>
<url>file:///${user.dir}/target/staging/release</url>
</repository>
<snapshotRepository>
<id>spring-snapshot</id>
<name>Spring Snapshot Repository</name>
<url>file:///${user.dir}/target/staging/snapshot</url>
</snapshotRepository>
</distributionManagement> -->
</project>
You can also use force update flag(-U) for example:
mvn clean install -U
Based on the error message
"Description Resource Path Location Type ArtifactDescriptorException:
Failed to read artifact descriptor for org.slf4j:slf4j-api:jar:1.5.6:
ArtifactResolutionException: Failure to transfer
org.slf4j:slf4j-api:pom:1.5.6 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.
it means you have to delete the folder $HOME/.m2/repository/org/slf4j and afterwards you need to rebuild via
mvn clean package
and other given error message:
Original error: Could not transfer artifact
org.slf4j:slf4j-api:pom:1.5.6 from/to central
(http://repo.maven.apache.org/maven2):
C:\Users\muhsin.HIFX.m2\repository\org\slf4j\slf4j-api\1.5.6\slf4j-api-1.5.6.pom.ahc0570cfa3a1934af5
(The system cannot find the file specified) pom.xml /sample line 1
Maven Dependency Problem"
indicates that you have some kind of problem with you repository access. Either you have a proxy which is not correctly configured. What i recommend is to use a repository manager which makes life easier.
You can try to run maven clean to perform a clean
You can manually navigate to the specified file in your local repository and remove it and then try to download it as afresh copy using mvn clean install -e
open this location
C:\Users...m2\repository\org\apache\maven\plugins\maven-surefire-plugin\2.10
Delete the file maven-surefire-plugin-2.10 and build the project.
it worked for me
Delete all the files present inside the folder **C:\Users\username.m2\repository**
open eclipse again rebuild the project - (Give some time for eclipse IDE to Build the Workspace).
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
add this line in the properties. Worked for me!

How to setup Eclipselink with JPA?

The Eclipselink documentation says that I need the following entries in my pom.xml to get it with Maven:
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
...
</dependency>
<dependencies>
...
<repositories>
<repository>
<id>EclipseLink Repo</id>
<url>http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo</url>
</repository>
...
</repositories>
But when I try to use #Entity annotation NetBeans tells me, that the class cannot be found. And indeed: there is no Entity class in the javax.persistence package from Eclipselink.
How do I have to setup Eclipselink with Maven?
The eclipselink artifact doesn't provide the JPA 2.0 API, you need to add javax.persistence:
<repositories>
<repository>
<id>eclipselink</id>
<url>http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.0.0</version>
<scope>provided</scope><!-- since I'm running inside a Java EE container -->
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
<scope>provided</scope><!-- since I'm running inside a Java EE container -->
</dependency>
...
I recommend to use the non OSGI EclipseLink jar for the sake of simplicity.
Just add the following to your pom.xml.
Now these artifats are in the maven repositories, so no need to add any <repository>
<!-- JPA -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
</dependency>
Or if you are using a Java EE application server use org.eclipse.persistence.jpa:org.eclipse.persistence, as it doesn't include dependecies that are already on the server.
<!-- JPA for Java EE application servers -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
When I look into my local maven repository, org.eclipse.persistence:eclipselink does indeed contain the persistence api, at least for version 2.0.0-SNAPSHOT of eclipselink.
But there is another set of dependencies in the eclipselink repository that are a bit more modularized. These are the dependencies I am using in a current project:
<!-- persistence api -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<!-- jpa implementation -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.0.2</version>
<scope>provided</scope>
</dependency>
Note that scope is set to provided since I deploy to glassfish which already contains eclipselink.
You can try to add
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>

Categories