in STS, referring other my own simple maven project is not working, what I am missing? - spring-boot

I am having a very simple problem, I have one spring boot starter project having only one class & I am referring it in another spring boot starter project, but getting error as :
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.590 s
[INFO] Finished at: 2021-02-13T10:25:21-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project demo1: Compilation failure: Compilation failure:
[ERROR] /Users/kedarmoghe/Documents/workspaces/travel/demo1/src/main/java/com/example1/demo/AddressProcessor.java:[3,24] package com.example.demo does not exist
[ERROR] /Users/kedarmoghe/Documents/workspaces/travel/demo1/src/main/java/com/example1/demo/AddressProcessor.java:[7,9] cannot find symbol
[ERROR] symbol: class Address
[ERROR] location: class com.example1.demo.AddressProcessor
[ERROR] /Users/kedarmoghe/Documents/workspaces/travel/demo1/src/main/java/com/example1/demo/AddressProcessor.java:[7,31] cannot find symbol
My pom.xml from project 1 is :
enter code here
<?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.4.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</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>
enter code here
My pom.xml in project-2 is :
enter code here
<?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.4.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example1</groupId>
<artifactId>demo1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo1</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</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>
<dependency>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
enter code here
In my STS I am not able to compile, what step I am missing ?
Thanks.

Projects that are packaged via the Spring Boot Maven Plugin are not naturally fit to be used as dependencies.
You can follow any of these references to edit project1's pom.xml as necessary to deploy an artifact JAR that can actually be used as a dependency, and then import that in project2:
https://www.baeldung.com/spring-boot-dependency
https://medium.com/xebia-france/import-spring-boot-application-as-a-maven-dependency-a25e03e5c3a

Related

Set up Multi-Module Maven Project with SpringBoot and React Sub-Modules

I am trying to setup a monorepo containing both a SpringBoot and a React Application. Currently, my module structure looks like the following:
root
+-- backend
| +-- pom.xml
+-- frontend
| +-- pom.xml
+-- pom.xml
Parent pom:
<?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.example</groupId>
<artifactId>multi-module-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>frontend</module>
<module>backend</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
frontend/pom:
<?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>org.example</groupId>
<artifactId>multi-module-demo</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>frontend</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
and backend/pom:
<?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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<artifactId>backend</artifactId>
<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</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>
While looking at the backend/pom.xml, I have the issue that the parent is not my parent pom, but the SpringBoot pom. This way however, I could technically not manage e.g. the version of the Project. Because currently the build output is
[INFO] Reactor Summary:
[INFO]
[INFO] multi-module-demo 1.0-SNAPSHOT ..................... SUCCESS [ 0.150 s]
[INFO] frontend 1.0-SNAPSHOT .............................. SUCCESS [ 0.784 s]
[INFO] backend 3.0.2 ...................................... SUCCESS [ 4.102 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
where you can see that the versions are not matching of each artifact.
My question is, how do I need to adapt the backend pom to match the frontend pom?
After some further digging, here's what I need to add to my parent pom:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.2</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

How to reference sibling module in a test for my maven spring boot multi-module project?

How can I include a sibling module as a test dependency for my spring boot tests in maven?
I have a little multi-module maven project with a spring boot web app (querying-api ), a common library (domain-definitions), and an initializing script (database-loader).
I'm writing test cases in my querying-api module to test my API, and I would like to run my database-loader service before the tests begin to load the database with predefined test data, simultaneously testing that the loader still works. However I'm getting the following error when running mvn clean package:
[ERROR] Failed to execute goal on project querying-api: Could not resolve dependencies for project com.my.little.package:querying-api:jar:1.0.0: Failure to find com.my.little.package:database-loader:jar:1.0.0 in http://mycompanysnexusrepo.com/nexus/content/repositories/EAJAVA/ was cached in the local repository, resolution will not be reattempted until the update interval of EAJAVA has elapsed or updates are forced -> [Help 1]
The tests have no problem referencing the common domain-definitions library...
Parent POM File:
<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>
<packaging>pom</packaging>
<name>my-little-project</name>
<description>Project for my little microservice</description>
<groupId>com.my.little.package</groupId>
<artifactId>my-little-project</artifactId>
<version>1.0.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring.security.version>2.3.5.RELEASE</spring.security.version>
<springfox.version>2.7.0</springfox.version>
</properties>
<modules>
<module>domain-definitions</module>
<module>database-loader</module>
<module>querying-api</module>
</modules>
<distributionManagement>
<repository>
<id>EAJAVA</id>
<url>http://mycompanysnexusrepo.com/nexus/content/repositories/EAJAVA/</url>
</repository>
</distributionManagement>
<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>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.my.little.package</groupId>
<artifactId>domain-definitions</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.my.little.package</groupId>
<artifactId>database-loader</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
querying-api POM file (Spring boot app for querying the database):
<?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>
<artifactId>querying-api</artifactId>
<packaging>jar</packaging>
<name>querying-api</name>
<description>Spring boot app for querying the database</description>
<parent>
<groupId>com.my.little.package</groupId>
<artifactId>my-little-project</artifactId>
<version>1.0.0</version>
</parent>
<dependencies>
<dependency>
<groupId>com.my.little.package</groupId>
<artifactId>domain-definitions</artifactId>
</dependency>
<dependency>
<groupId>com.my.little.package</groupId>
<artifactId>database-loader</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>querying-api</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
domain-definitions POM file (Common library):
<?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.my.little.package</groupId>
<artifactId>my-little-project</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>domain-definitions</artifactId>
<name>domain-definitions</name>
<description>Classes to define the structure of the tables</description>
</project>
database-loader POM 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>
<artifactId>database-loader</artifactId>
<packaging>jar</packaging>
<name>database-loader</name>
<description>Java script to load data into the database for the first time</description>
<parent>
<groupId>com.my.little.package</groupId>
<artifactId>my-little-project</artifactId>
<version>1.0.0</version>
</parent>
<dependencies>
<dependency>
<groupId>com.my.little.package</groupId>
<artifactId>domain-definitions</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
This might be because of the library jar not found in the local repository. You need to first execute :
mvn clean install.
This will install the lib jar in your local repository and maven can easily find it when you execute package goal.
Explained here: How are "mvn clean package" and "mvn clean install" different?
Furthermore, if you are using the sibling module only in tests then you can define the scope as test in dependency.
<dependency>
<groupId>com.my.little.package</groupId>
<artifactId>domain-definitions</artifactId>
<scope>test</scope>
</dependency>

Error: Failed to execute goal on projectorg.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile

I tried configuring spring framework in eclipse. And try building a sample. It is giving me the following error.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project springBootHelloWorld: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] Failed to execute goal on project springBootHelloWorld: Could
not resolve dependencies for project
com.javaInUse:springBootHelloWorld:jar:0.0.1-SNAPSHOT: The following
artifacts could not be resolved:
org.springframework:spring-core:jar:5.0.10.RELEASE,
org.xmlunit:xmlunit-core:jar:2.5.1: Could not transfer artifact
org.springframework:spring-core:jar:5.0.10.RELEASE from/to central
(https://repo.maven.apache.org/maven2):
C:\Users\jkalansrayan.m2\repository\org\springframework\spring-core\5.0.10.RELEASE\aether-f4279e83-b0c7-471b-8dca-f684b2238c2d-spring-core-5.0.10.RELEASE.jar-in-progress
(The system cannot find the file specified) -> [Help 1]
POM 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.javaInUse</groupId>
<artifactId>springBootHelloWorld</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>springBootHelloWorld</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.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>
Check internet connectivity because it may be proxy issue.
Remove local maven .m2 reposiotory folder and do mvn clean install again will resolve the issue.
If above solutions don't work then attach the pom.xml file in the question.

Non-resolvable parent POM in Maven Project made with http://start.spring.io/

I've created a Maven Project using Spring Initializr, but when I try to build it I get the following error:
[ERROR] The project com.example:demo:0.0.1-SNAPSHOT (/home/alessandro/Work/workspaces/demo/pom.xml) has 1 error
[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.2.RELEASE from/to repo (http://artifactory.dev.*****.it/artifactory/repo): Failed to transfer http://artifactory.dev.*****.it/artifactory/repo/org/springframework/boot/spring-boot-starter-parent/1.4.2.RELEASE/spring-boot-starter-parent-1.4.2.RELEASE.pom. Error code 504, Gateway Time-out and 'parent.relativePath' points at no local POM # line 14, column 10 -> [Help 2]
the auto-generated pom.xml is the following:
<?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>war</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.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-tomcat</artifactId>
<scope>provided</scope>
</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>
I tried to specify a relative path inside the parent tag (like '../pom.xml') without success, can anyone help me please?
Thanks
Nothing to do with start.spring.io.
You most probably have a custom ~/.m2/settings.xml where everything (or Maven Central) is proxied to http://artifactory.dev.*****.it/artifactory/repo/
Failed to transfer http://artifactory.dev.*****.it/artifactory/repo/org/springframework/boot/spring-boot-starter-parent/1.4.2.RELEASE/spring-boot-starter-parent-1.4.2.RELEASE.pom.
If that artifactory server is supposed to fetch outside, maybe there's a network glitch or something. Regardless, please ask the admin of that server for help.

Spring Boot with spring-boot-starter-web fails to compile in maven

I am using jdk1.7 and spring boot 1.4.2.Release.I created a brand new Spring boot project from start.spring.io. It compiled fine. I tried to add the below dependency for exposing a REST web service.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
I get the below error:
[ERROR] Failed to execute goal on project demo: Could not resolve
dependencies for project com.example:demo:jar:0.0.1-SNAPSHOT: Failed to
collect dependencies at org.springframework.boot:spring-boot-starter-
web:jar:1.4.2.RELEASE -> org.hibernate:hibernate-validator:jar:5.2.4.Final:
Failed to read artifact descriptor for org.hibernate:hibernate-
validator:jar:5.2.4.Final: Could not transfer artifact
org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.2 from/to spring-ext
(http://repo.spring.io/ext-release-local/): repo.spring.io: Unknown host
repo.spring.io -> [Help 1]
It takes the http://repo.spring.io/ext-release-local link which does not have jboss related files.
Please let me know if I am doing something wrong.
Your pom should look 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>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.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-data-rest</artifactId>
</dependency>
<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>
after that you need to run it with command mvn spring-boot:run from the project directory
I hope this time it will defenetly work only need to copy and pase this pom content to your pom file
To build spring boot application from scratch you can follow the link
In my case, just adding the repository configuration to the pom.xml didn't work. I had to add the following code into /maven-installation-dir/conf/settings.xml file.
<mirror>
<id>central-proxy</id>
<name>central-proxy</name>
<url>http://corporate-intranet/repo/url</url>
<mirrorOf>central</mirrorOf></mirror>
I hope it helps someone.

Resources