I have created a new Springboot application. I am getting an error in POM.xml which is,
Project build error: Non-resolvable parent POM for
org.springframework.boot:spring-boot-sample-activemq:[unknown-version]: Could not transfer artifact org.springframework.boot:spring-boot-samples:pom:${revision} from/to central (https://repo.maven.apache.org/maven2): PROXY and 'parent.relativePath' points at wrong local POM
I have tried updating and cleaning the project. But did not work.
Tried deleting the contents in m2/repositry folder but did not work.
My Settings.xml looks like this,
<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>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>PROXY</host>
<port>3120</port>
<nonProxyHosts>maven</nonProxyHosts>
</proxy>
</proxies>
</settings>
and also i am trying to connect the url through telnet in cmd. but it say
Connecting To repo.maven.apache.org...Could not open connection to the host, on port 3120: Connect failed
My POM.xml Looks like this,
<?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>
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
<artifactId>spring-boot-samples</artifactId>
<groupId>org.springframework.boot</groupId>
<version>${revision}</version>
</parent>
<artifactId>spring-boot-sample-activemq</artifactId>
<name>Spring Boot ActiveMQ Sample</name>
<description>Spring Boot ActiveMQ Sample</description>
<properties>
<main.basedir>${basedir}/../..</main.basedir>
</properties>
<dependencies>
<!-- Compile -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
<!-- Test -->
<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>
</project>
I am working in office environment ..could it be because of firewall issue.. please help ??
There is maybe a proxy issue, but first, you're getting Could not transfer artifact org.springframework.boot:spring-boot-samples:pom:${revision} just because there is no artifact org.springframework.boot:spring-boot-samples in Maven Central : https://search.maven.org/search?q=g:org.springframework.boot%20AND%20a:spring-boot-samples. You are also referring to a property (${revision}) not defined in your POM.
I think you have just copied the example from GitHub where spring-boot-samples is actually defined, but this is an internal module.
You should first read Spring Boot docs about bootstraping projects. Have you noticed the comment in <parent> section of the POM?
<!-- Your own application should inherit from spring-boot-starter-parent -->
For issues related to the proxy, I suggest you to read more about configuring proxies. You also probably need authentication.
Related
I have spring boot parent project hosted on Google Cloud Storage. I am using GoogleStorageWagon. I am able to deploy parent to GCS, But I am not able to download it.
Child project pom.xml
<?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>
<parent>
<groupId>com.myorg.common</groupId>
<artifactId>myorg-starter-parent</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>test-project</artifactId>
<version>1.0.0</version>
<name>test-service</name>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>com.gkatzioura.maven.cloud</groupId>
<artifactId>google-storage-wagon</artifactId>
<version>1.0</version>
</extension>
</extensions>
</build>
<repositories>
<repository>
<id>com.myorg.common</id>
<url>gs://myorg-library</url>
</repository>
</repositories>
</project>
Error I am having is as below.
I've tried changing bucket policies as well as different account with admin access. But, I'm not able to resolve.
For anyone, who is having this problem,
Maven was trying to find google-storage-wagon in GCR, which was not hosted that. In order to tell maven to download this from Maven central, I had to this extension in .mvn/extensions.xml project folder.
.mvn/extensions.xml file will look like below:
<extensions>
<extension>
<groupId>com.gkatzioura.maven.cloud</groupId>
<artifactId>google-storage-wagon</artifactId>
<version>1.0</version>
</extension>
</extensions>
Now, maven will download this plugin from maven central and after that it will download parent pom.xml from GCR using this plugin.
I am hosting a Local Repository with 80+ Jar files which are related to our internal Project
Something like this
I want to add a tag in my Maven pom.xml where in I retrieve all the jar files in one shot when I create a new project in Eclipse.
These jars are static and will not change.
Can anyone please help in setting up this?
In Artifactory - "Set me Up", I can see this TAG, but its for pushing a final jar
You have at least two options:
1. Use a parent pom
Add all the 80 dependencies to a POM which looks like this:
<?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>your.company</groupId>
<artifactId>ourDependencies</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging> <!-- IMPORTANT -->
<dependencies>
<!-- place here 80 dependencies -->
<dependency>
...
</dependency>
</dependencies>
<build> <!-- optional -->
<plugins>
<plugin>
...
</plugin>
</plugins>
</build>
<distributionManagement>
... <!-- optional -->
</distributionManagement>
</project>
In the project that needs the dependencies, add a <parent> element to the pom.xml:
<project>
<groupId>your.company</groupId>
<artifactId>newApplication</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging> <!-- or war or ... -->
....
<parent>
<groupId>your.company</groupId>
<artifactId>ourDependencies</artifactId>
<version>1.0.0</version>
</parent>
...
</project>
Keep in mind that every project can have only one parent.
2. Create an archetype
This way is more complex. You can create a simple project similar to "HelloWorld" which contains all the dependencies. Based on this project, you can create an archetype which serves as a template when you create a new Maven project.
More Informations:
Introduction to archetypes
archetype tutorial
I am new to Spring.I downloaded SpringToolSuite 3.7.2 and i am trying to create a simple SpringBootApplication.
I go to File->New Spring Starter Project,Select Type as Maven project and Under dependencies i selected Web and click on Finish. I get an error on my parent tag in pom.xml and also not able to see the maven dependency libraries.
I tried right clicking on the project->Select Maven->Update Projects-> Checked all boxes and Update but does not work. I also tried cleaning the repository under C:{User}.m2 clean and rebuild the project but did not work for me.Screenshot of the STS
Project build error: Non-resolvable parent POM for com.example:demo:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.4.3.RELEASE from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org and 'parent.relativePath' points at no local POM
Please tell me what am i missing.
Below is my pom.xml
<?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>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>SpringApplication1</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</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>
</project>
The error suggests that you are not able to connect to (https://repo.maven.apache.org/maven2).
Please check your maven settings.xml (Window -> Preferences -> Maven -> Global/User Settings):
If you are using proxy, you need to add it on your settings.xml.
Something like this :
<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
https://maven.apache.org/xsd/settings-1.0.0.xsd">
...
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts>
</proxy>
</proxies>
...
</settings>
As you can see on https://maven.apache.org/settings.html.
If you are not using proxy, be sure that you don't have any proxy configuration on your settings.
We have a spring boot application which has its parent defined as spring-boot-starter-parent. But in our project, we have a parent pom with distribution management defined in it, and all the submodules in the project inherit from it. Now, since the spring boot application already inherits from spring-boot-starter-parent, and I do not want to duplicate the distribution management, I thought of having a custom spring boot starter module just to be able to define the distribution management in there and then include this custom spring boot starter as a dependency in the spring boot application. But when I do a mvn clean install deploy of the spring boot application it fails with the error shown below:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.
2:deploy (default-deploy) on project crs-acc-eve-gridgain-load-app: Deployment f
ailed: repository element was not specified in the POM inside distributionManage
ment element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help
1]
Is it the right way to achieve this? or there any other recommended ways of doing it?
Given below are the poms of custom spring boot starter parent module:
<?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">
<parent>
<artifactId>crs-micro-services</artifactId>
<groupId>com.ing.crs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>crs-spring-boot-starter-parent</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>1.3.5.RELEASE</spring-boot.version>
</properties>
<modules>
<module>crs-spring-boot-starter</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<id>XXXX</id>
<name>XXXX</name>
<url>XXXX</url>
</repository>
<snapshotRepository>
<id>XXXX</id>
<name>XXXX</name>
<url>XXXX</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
</project>
And this..for the starter module
<?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">
<parent>
<artifactId>crs-spring-boot-starter-parent</artifactId>
<groupId>com.ing.crs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>1.0-SNAPSHOT</version>
<artifactId>crs-spring-boot-starter</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
</dependencies>
</project>
And the sprng boot application has this dependency
<dependency>
<groupId>com.ing.crs</groupId>
<artifactId>crs-spring-boot-starter</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>import</scope>
</dependency>
Thanks and regards,
Priya
There is no requirement that your build should be configured with the spring-boot-starter-parent. If you already have a parent with some distribution management, feel free to keep it. You'll need to adapt the parent a bit. Here are couple of options:
If the whole project is spring boot based, maybe your parent could inherit from the Spring Boot starter parent? This may not work if you have a parent that is used within the entire organization
You can keep your parent as it is and use the spring-boot-dependencies BOM instead. See the documentation for more details. You'll have to copy the bits of the parent that you use (such as the plugin definition) but it's not a ton of work.
Your proposal will never work. BOM only imports <dependencyManagement>. What you're looking for is mixin and it's not supported by Maven yet.
I am not able to use 1.3.0.RELEASE version of spring-boot in my project. Following is 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc</groupId>
<artifactId>xyz</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I am getting following error:
Project build error: Non-resolvable parent POM for
com.elm:elm:[unknown-version]: Failure to find
org.springframework.boot:spring-boot-starter-parent:pom:1.3.0.RELEASE
in 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 and
'parent.relativePath' points at wrong local POM pom.xml /elm line
8 Maven pom Loading Problem
Your local cached repository seems to be messed up.
Either you can force maven to download dependencies with
mvn clean install -U
or you can clean your cached repository by removing <USER_HOME>/.m2/repository directory.