I created a new maven project using the following maven command
mvn archetype:generate -DgroupId=com.company.lib_name -DartifactId=lib_name -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
When I open this newly created project in eclipse it gives the following error:
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar- plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.3.2
Plugin org.apache.maven.plugins:maven-jar-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.3.2: Hostname cannot be null
I tried th following:
Deleted the .m2/repository and rebuilt the project
Verified that the artifact exists in the maven repo
Maven user settings point to the correct settings.xml
Project compiles on the command line
Cleaned the project
Forced updates n the project
Checked repo to see all the dependencies are downloaded
Change eclipse to use the external maven instead of embeded
Also I am using Kepler and Maven 3.
Any idea what 'hostname cannot be null' is pointing at?
THis is the pom content
<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.company.lib</groupId>
<artifactId>liby</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>lib</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
</dependencies>
</project>
And the settings.xml
<settings>
<profiles>
<profile>
<id>Blah</id>
<repositories>
<repository>
<id>inhouse</id>
<url>http://mavenrepo/maven2_repositories/inhouse</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>inhouse_snapshot</id>
<url>http://mavenrepo/maven2_repositories/inhouse_snapshot</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>inhouse</id>
<url>http://mavenrepo/maven2_repositories/inhouse</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>inhouse_snapshot</id>
<url>http://mavenrepo/maven2_repositories/inhouse_snapshot</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>company_name</activeProfile>
</activeProfiles>
<mirrors>
<mirror>
<id>central-to-nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://mw_maven_repository_readonly/nexus/content/groups/cached</url>
</mirror>
</mirrors>
It seems that you have created the project from Maven Template but you did not make this project as an Eclipse project before import it in Eclipse.
So after create a new maven project using the maven command you should also execute the below command to make the project as an Eclipse project
mvn eclipse:eclipse
It will generate all project files that are required by Eclipse IDE.
I also prefer to execute "mvn clean install" before import the project in Eclipse.
At command prompt :
mvn eclipse:eclipse
mvn clean install
This should download all dependencies
Thank you all for the answers. but the problem was with the maven repo url.
Related
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.
I have created a spring boot application and imported it into the STS. but when i tried to perform "Maven Update", it shows the following error in pom.xml file as well as didnt get updated. Any help would be appreciated. Thanks!
The error is as follows:-
**
Project build error: Non-resolvable parent POM for
com.example:demo:0.0.1-SNAPSHOT: Failure to transfer
org.springframework.boot:spring-boot-starter-parent:pom:2.0.3.RELEASE
from https://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.springframework.boot:spring-boot-starter-parent:pom:2.0.3.RELEASE
from/to central (https://repo.maven.apache.org/maven2):
java.lang.RuntimeException: Unexpected error:
java.security.InvalidAlgorithmParameterException: the trustAnchors
parameter must be non-empty and 'parent.relativePath' points at no
local POM
**
This is my pom.xml file.
<?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>com.example</groupId>
<artifactId>DigitalEmployeeDB</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>DigitalEmployeeDB</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.itextpdf/kernel for Pdf Generation-->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.0.6</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>7.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi for Excel Generation -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.5-beta5</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10-FINAL</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Faced the same issue on my office laptop. They say, its due to some blockage by the firewall. Some network config should be done to get rid of this issue.
I reinstall default-jdk on Ubuntu. And i solved it.
Please refer to following link.
Maven: trustAnchors parameter must be non-empty and 'parent.relativePath' # InvalidAlgorithmParameterException # Non-resolvable parent POM
create setting.xml at location "${user.home}/.m2/settings.xml"
Then add your office maven central repository as shown below
<settings>
...
<profiles>
...
<profile>
<id>myprofile</id>
<repositories>
<repository>
<id>my-repo2</id>
<name>your custom repo</name>
<url>http://jarsm2.dyndns.dk</url>
</repository>
</repositories>
</profile>
...
</profiles>
<activeProfiles>
<activeProfile>myprofile</activeProfile>
</activeProfiles>
...
</settings>
I donwloaded a new spring boot application (version 2.0.0) from https://start.spring.io/ and I tried to build it using netbeans IDE.
During the maven build I got the following error :
The build could not read 1 project -> [Help 1]
The project com.deepit.springboot.example:spring-boot-in-deep:0.0.1-SNAPSHOT (~=NetBeansProjects\spring-boot-in-deep\pom.xml) has 1 error
Non-resolvable parent POM: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.BUILD-SNAPSHOT from/to spring-snapshots (https://repo.spring.io/snapshot): repo.spring.io and 'parent.relativePath' points at no local POM # line 14, column 10: Unknown host repo.spring.io -> [Help 2]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
Do you have an idea about the cause of this error ?
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>com.deepit.springboot.example</groupId>
<artifactId>spring-boot-in-deep</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>spring-boot-in-deep</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
To resolve this I add a proxy in the settings.xml file in the config folder of maven.
To know the location of your settings file, start maven with -X option (debug) and examine the beginning of the output.
#Ayadi Akrem
Can you post the contents of your POM?
Update: POM looks ok. I would guess a connection error (even though you said you tested it).
I am trying to convert KML files to geoJson file by following Convert Kml with multiple features to Geojson .
However, I am unable to get below jars as maven dependencies which contains below classes.
KMLConfiguration
FeatureJSON.
below is my pom.xml:
http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
com.test.data
Converter
0.0.1-SNAPSHOT
Archetype - Converter
http://maven.apache.org
<dependencies>
<!-- https://mvnrepository.com/artifact/pull-parser/pull-parser -->
<dependency>
<groupId>pull-parser</groupId>
<artifactId>pull-parser</artifactId>
<version>2.1.10</version>
</dependency>
<dependency>
<groupId>org.geotools.xsd</groupId>
<artifactId>gt-xsd-core</artifactId>
<version>9.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.owasp.encoder/encoder -->
<dependency>
<groupId>org.owasp.encoder</groupId>
<artifactId>encoder</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-configuration/commons-configuration -->
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.opengis</groupId>
<artifactId>geoapi</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository> <!--Add the snapshot repository here -->
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>opengeo</id>
<name>OpenGeo Maven Repository</name>
<url>http://repo.opengeo.org</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>boundless</id>
<name>Boundless Maven Repository</name>
<url>http://repo.boundlessgeo.com/main</url>
</repository>
</repositories>
I was following that guide too and managed to sort out maven deps. Here is my dependencies:
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-main</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools.xsd</groupId>
<artifactId>gt-xsd-core</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools.xsd</groupId>
<artifactId>gt-xsd-kml</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geojson</artifactId>
<version>${geotools.version}</version>
</dependency>
with repository
<repository>
<id>boundlessgeo.com</id>
<url>http://repo.boundlessgeo.com/main/</url>
</repository>
<repository>
<id>download.osgeo.org</id>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
and property
<geotools.version>17.2</geotools.version>
Sorry for late reply (less than a year BTW :D).
Hope it helps.
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>