Maven Repository updation and maintenance - java

I just downloaded a Spring tutorial off the internet and am trying to run it in my local workspace. To do it, I first tried to get all the dependant jars needed by the project. I tried maven build and it failed because dependant jar's were missing from my local repository and those jar's were also missing from the remote repository(the one which my project uses)
Initially, my settings.xml only has a reference to the remote repository url which is used across the organization by various projects. I cannot expect it to be uptodate with latest jars. Can I get the remote repository names of the various utility projects fore.g for Log4j, commons logging, spring jars etc. I can then put these repository urls in my setting.xml to solve my issue.
EDIT:
I even tried "http://repo1.maven.org/maven2/" which I thought houses all the required latest jars but even this wont work.
Example..
Missing:
1) log4j:log4j:jar:1.2.13
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=log4j -DartifactId=log4j \
-Dversion=1.2.13 -Dpackaging=jar -Dfile=/path/to/file
Path to dependency:
1) com.mkyong.core:Spring3Example:jar:1.0-SNAPSHOT
2) org.codehaus.castor:castor:jar:1.1.2.1
3) log4j:log4j:jar:1.2.13
2) xerces:xerces:jar:1.4.0
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=xerces -DartifactId=xerces \
-Dversion=1.4.0 -Dpackaging=jar -Dfile=/path/to/file
Path to dependency:
1) com.mkyong.core:Spring3Example:jar:1.0-SNAPSHOT
2) org.codehaus.castor:castor:jar:1.1.2.1
3) xerces:xerces:jar:1.4.0
3) commons-lang:commons-lang:jar:2.5
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=commons-lang -DartifactId=commons-lang
\
-Dversion=2.5 -Dpackaging=jar -Dfile=/path/to/file
My pom.xml:
<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>com.mkyong.core</groupId>
<artifactId>Spring3Example</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Spring3Example</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>3.0.5.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Uses Castor for XML -->
<dependency>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor</artifactId>
<version>1.1.2.1</version>
</dependency>
<!-- Castor need this -->
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
My setting .xml
<settings>
<localRepository>
C:\Repository
</localRepository>
<interactiveMode>true</interactiveMode>
<offline>false</offline>
<profiles>
<profile>
<id>R2</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>Log4j</id>
<url>http://central.maven.org/maven2</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>Artifact_Repository_Plugin</id>
<url>http://central.maven.org/maven2</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<pluginGroups>
<pluginGroup>com.hsbc.alm.maven.plugins</pluginGroup>
<pluginGroup>com.hsbc.alm.maven.scm</pluginGroup>
<pluginGroup>com.hsbc.alm.maven.jr2</pluginGroup>
</pluginGroups>
</settings>

Yes you are on the right path all you need to do is this or a good solution would be to generate a new archetype with the all added jar files which you have downloaded. And then using the same artifact whenever you make a similar project.
Even if you are lacking with the m2Eclipse plugin , you can use the following commands.
This can be achieved if you follow the commands as:
Move to the project and type the following command to make the project as archetype
mvn archetype:create-from-project
Install the archetype to the local repository
mvn install
Move to some directory where you wish to locate the new project created with your created archetype
mvn archetype:generate -DarchetypeCatalog=local
If a list is populated with numbers to filter then select accordingly and you are done.

This one is building successfully (pom.xml):
<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.test.new.project</groupId>
<artifactId>dadada</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>dadada</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>3.0.5.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Uses Castor for XML -->
<dependency>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor</artifactId>
<version>1.1.2.1</version>
</dependency>
<!-- Castor need this -->
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
</project>
My settings.xml :
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
</mirrors>
<profiles>
</profiles>
</settings>
Not sure why you need to alter settings.xml is there specific reason?
Environment info :
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.6.0_29

I was finally able to solve the jar download issue by defining proxy settings in my settings.xml. My company uses a proxy to communicate with outside world.Having said that, I also learnt that there is no need to define specific remote repository in settings.xml bcos maven by default searches in its own repository which mostly has all the opensource jars.
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>xyz.hk.hsbc</host>
<port>8080</port>
</proxy>
</proxies>

Related

Maven project is not able to download artifacts from Azure Artifacts

Another way to ask this question is:
How to authenticate maven project with Azure personal access token so that Maven build can download artifacts published on Azure Artifacts
I have Personal access token, to authenticate. But the problem is what would be the pom.xml which help maven project to authenticate.
Or more simple words
How to configure the maven project to download artifacts from maven central repo and some private artifact publisher also. In my case private artifact publisher is Azure Artifacts.
Fist of all set your Azure Personal Access Token in system environment variable.
like environment variable name key is AZURE_PAT then access this in settings.xml
You just need to add a settings.xml under C:\Users\<UserName>\.m2
settings.xml will be like
<settings>
<servers>
<server>
<id>AzureRepo</id>
<username>AZURE_ARTIFACTS</username>
<password>${env.AZURE_PAT}</password>
</server>
</servers>
</settings>
Then Open pom.xml and add the following repository attribute under repositories attribute. Your azure artifactory URL will be provided by Azure artifactory.
<repository>
<id>AzureRepo</id>
<url>Artifactory URL provided by Azure</url>
</repository>
So your pom.xml will look like this. BTW this pom.xml have spring dependencies.
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.basic</groupId>
<artifactId>basic</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>basic</name>
<description>basic maven project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Central Maven repository</id>
<name>Central Maven repository https</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
</repository>
<repository>
<id>AzureRepo</id>
<url>Artifactory URL provided by Azure</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>Central Maven repository</id>
<name>Central Maven repository https</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
This can help you to download azure artifact in maven repository.

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.

Add external library .jar to Spring boot .jar /lib without mvn install

I've been reading around on this site and others, trying to figure out how add these external jars without doing mvn install, and haven't had any success. I was reading somewhere that maven-shade could address my problem, but I could never get that to work? I know spring boot doesn't like system scope but it seems to error out if I choose something else?
<?xml version="1.0" encoding="UTF-8"?>
<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>org.springframework</groupId>
<artifactId>gs-rest-service</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
...
<dependency>
<groupId>sample</groupId>
<artifactId>com.sample</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/enterprise.jar</systemPath>
</dependency>
<dependency>
<groupId>sample1</groupId>
<artifactId>com.sample1</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/gs.jar</systemPath>
</dependency>
<dependency>
<groupId>sample2</groupId>
<artifactId>com.sample2</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/Util.jar</systemPath>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
<start-class>ves.sfdc.Application</start-class>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
You can create a new directory "lib" on your project, put your jars in this directory and then add them to your classpath.
If your IDE is IntelliJ you can follow this link:
Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project
If you use another IDE you have to find on google how to add jar on your project classpath.

Missing Artifact error in MAVEN in geoserver

<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>org.geoserver</groupId>
<artifactId>hello_wps</artifactId>
<packaging>jar</packaging>
<version>8-ENTERPRISE-SNAPSHOT</version>
<name>hello_wps</name>
<dependencies>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-process</artifactId>
<version>8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.geoserver</groupId>
<artifactId>main</artifactId>
<version>8-ENTERPRISE-SNAPSHOT</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mockrunner</groupId>
<artifactId>mockrunner</artifactId>
<version>0.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>opengeo</id>
<name>opengeo</name>
<url>http://repo.opengeo.org</url>
</repository>
</repositories>
</project>
i'm new to maven and geoserver as well. was just trying basic installation of geoserver and found the error in POM.XML file of maven project. Error is shown in two <dependency> tabs which are exactly 1st and 2nd after <dependencies> tab.
Errors :
Missing artifact org.geotools:gt-process:jar:8-SNAPSHOT
Missing artifact org.geoserver:main:jar:tests:8-ENTERPRISE-SNAPSHOT
Thanks for the solution in advance.
If you look at the quick start docs for geotools:
http://docs.geotools.org/latest/userguide/tutorial/quickstart/maven.html
step 7 "under Creating a new project"
If you are using a nightly build (such as 14-SNAPSHOT) and add a
reference to the snapshot repository.
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>boundless</id>
<name>Boundless Maven Repository</name>
<url>http://repo.boundlessgeo.com/main</url>
</repository>
</repositories>
I have taken a quick look at the versions available in this repository and to use it, you will need to change your maven co-ordinates to something like:
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-process</artifactId>
<version>10-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.geoserver</groupId>
<artifactId>main</artifactId>
<version>2.4.8</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
as the original versions you are after are not present.

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!

Categories