In pom .xml it's showing error: Failure to transfer org.apache.maven.shared:file-management:pom:3.0.0 - eclipse

I created the project from Spring Initializr: https://start.spring.io/.
After importing it as a maven project in eclipse it's showing error in the pom.xml file that:
Description Resource Path Location Type Failure to transfer
org.apache.maven.shared:file-management:pom:3.0.0 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.apache.maven.shared:file-management:pom:3.0.0 from/to central
(https://repo.maven.apache.org/maven2):
repo.maven.apache.org pom.xml /SpringApp line 1 Maven Configuration
Problem
Error marked only the first line of code.
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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
</parent>
<groupId>com.example</groupId>
<artifactId>SpringApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SpringApp</name>
<description>Demo project for Spring Boot</description>
<properties>
<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>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</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>

This is due to corrupted/failed downloads which are causing the problem to update your maven project.
If you are a windows user please run this command in CMD
cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i
this will delete all the failed downloads from the local repository.
after this completes you can update dependencies of your project by
Right-click on the project->Maven->Update Project->check the checkbox "Force Update of Snapshots/Releases" and click OK.

Related

"target" subdirectories in package explorer in recent eclipse (at least 4.13 + maven 3.6.x)

So in Eclipse 4.13 (and maybe a few versions before) with embedded maven 3.6.x, when I open a simple, almost empty, maven project, it shows me these non existant subdirectories in project explorer :
target/generated-sources/annotations
target/generated-sources/test-annotations
If I remove them from source directories (in project > properties > java build path), eclipse creates these directories and add them as sources again, so I guess it comes from some maven plugin conf somewhere.
How do I get rid of these 2 directories display when I don't have use of them ?
And since this problem probably comes from a combination of maven 3.6 + Eclipse 4.13 + some maven dependency, here 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>my.comp</groupId>
<artifactId>file-mgt-backend</artifactId>
<version>${revision}</version>
<name>My project</name>
<properties>
<java.version>1.8</java.version>
<springfox.version>2.9.2</springfox.version>
<!-- Downgrade to 3.1.1 needed for Eclipse bug : https://bugs.eclipse.org/bugs/show_bug.cgi?id=547340 -->
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<!-- Sane default when no revision property is passed in from the commandline -->
<revision>0-SNAPSHOT</revision>
</properties>
<scm>
<developerConnection>(...)</developerConnection>
</scm>
<!-- Paramètres de publication de l'artifact -->
<distributionManagement>
<repository>
(...)
</repository>
</distributionManagement>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.9.RELEASE</version>
</parent>
<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>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.11.2</version>
</plugin>
</plugins>
</build>
</project>

When I generate Spring starter project with eclipse STS tools there is an error occurs in pom.xml first line. But I found no error in pom.xml

I have created a Spring starter project with eclipse STS tool after creating project there is an error in pom.xml first. But I found no error. I have tried Updating project with and with out forcefully but error still persists
Thank you
<?xml version="1.0" encoding="UTF-8"?> <!-- error occurs here -->
<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>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.web-app</groupId>
<artifactId>FirstWebApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>FirstWebApp</name>
<description>Demo project for Spring Boot</description>
<properties>
<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-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</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>
Project runs but not working.
[This is the image of eclipse workspace] [1]: https://i.stack.imgur.com/a9fGB.png
Well , this is the latest well known problem of Eclipse when working with Spring Boot 2.1.5.
The workaround is to add the following to pom.xml :
<properties>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>

Module-info.java won't compile in maven project (Syntax error on token "module", interface expected)

I am starting a new maven project that should run with Spring Boot (in case that's relevant), and it compiled fine. But then, I decided to start using Java9-modules. So, I had eclipse generate the module-info.java file that looks like this:
module BirdTreeModel {
exports mjl.familytree.birdtree;
requires junit;
requires spring.boot;
requires spring.boot.autoconfigure;
requires spring.boot.test;
requires spring.test;
}
This causes a compile error, however. Eclipse says: "Syntax error on token "module", interface expected".
(And when I do a Maven clean install, it says "Compilation failure: ...module not found: junit" and same for modules spring.boot.test and spring.test).
echo %JAVA_HOME% gives C:\Program Files\Java\jdk-12
mvn -version gives:
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T20:33:1
4+02:00)
Maven home: `D:\Programming practice\maven\apache-maven-3.5.4\bin\..`
Java version: 12, vendor: Oracle Corporation, runtime: `C:\Program Files\Java\jdk-12`
Default locale: `en_US`, platform encoding: `Cp1252`.
OS name: "Windows 7", version: "6.1", arch: "AMD64", family: "Windows"
The run configurations of the Maven build of the project are also on JDK-12
My pom 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>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>mjl.familytree</groupId>
<artifactId>birdtree-model-dao</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>birdtree-model-dao</name>
<description>My family tree program</description>
<repositories>
<repository>
<id>repository.spring.release</id>
<name>Spring GA Repository</name>
<url>http://repo.spring.io/release</url>
</repository>
</repositories>
<properties>
<maven.compiler.source>1.12</maven.compiler.source>
<maven.compiler.target>1.12</maven.compiler.target>
<maven.compiler.release>12</maven.compiler.release>
<java.version>12</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

Hierarchical dependency issue on Maven Build

This is the error I have when building my Maven Project.
Source of project: Project, Github link
Setup: Eclipse IDE on Windows.
[ERROR] Failed to execute goal on project uicontroller-service: Could not resolve dependencies for project poc.microsvc-angular:uicontroller-service:jar:0.1.0: Failed to collect dependencies at poc.microsvc-angular:microservice-common:jar:0.0.1-SNAPSHOT -> org.apache.kafka:kafka_2.10:jar:0.8.2.1 -> org.apache.zookeeper:zookeeper:jar:3.4.6 -> org.slf4j:slf4j-log4j12:jar:1.7.21: Failed to read artifact descriptor for org.slf4j:slf4j-log4j12:jar:1.7.21: Could not transfer artifact org.slf4j:slf4j-log4j12:pom:1.7.21 from/to public (https://globalrepository.mclocal.int/artifactory/public): connect timed out -> [Help 1]
[ERROR]
Here is my pom.xml 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>
<groupId>poc.microsvc-angular</groupId>
<artifactId>uicontroller-service</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<relativePath />
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<docker.plugin.version>0.3.258</docker.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
</dependency>
<dependency>
<groupId>poc.microsvc-angular</groupId>
<artifactId>microservice-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.10</version>
<configuration>
<imageName>microsvc-angular/${project.name}</imageName>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<skipDockerBuild>false</skipDockerBuild>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
Is there a chance of corrupted jars or is it something else?
Looks like your local ~/.m2/settings.xml or C:\Users\myUserName\.m2\settings.xml for windows has configuration to point to a corporate /internal mirror of maven central. You can temporarily remove this potentially to fix your issue.

gwt-servlet.jar missing in the WEB-INF/lib on compiling GWT with maven

In my pom file, I have included the dependency of gwt-servlet but if i run mvn clean install and mvn eclipse:eclipse and open the project in eclipse, I get the following error
GWT SDK JAR gwt-servlet.jar is missing in the WEB-INF/lib directory
EDIT :
Here is my dependency (we use a custom maven repository):
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smart-gwt</artifactId>
<version>2.5</version>
</dependency>
EDIT 2 (main pom):
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
</extension>
</extensions>
....
There are two things I noticed.
1) The smartgw dependency you specified cannot be resolved from the maven central repository
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smart-gwt</artifactId>
<version>2.5</version>
</dependency>
It only has the 2.4 version of smartgw (see here http://search.maven.org/#search%7Cga%7C1%7Csmartgwt) Instead I had to use this
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>2.4</version>
</dependency>
notice that the artifact ID is different too. (If you have a custom repository containing this then please update your question)
2) You dont need to do eclipse:eclipse instead you can issue the
File > Import > Existing Maven projects
this will auto generate the eclipse project from your pom.xml
UPDATE
I tested with the following :
Parent pom in gwttest2 folder
<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</groupId>
<artifactId>gwttest2-main</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>gwttest2-module1</module>
</modules>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
</extension>
</extensions>
</build>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
</project>
child pom in gwttest2/gwttest2-module1 folder
<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</groupId>
<artifactId>gwttest2-module1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
<artifactId>gwttest2-main</artifactId>
<groupId>com.test</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
</extension>
</extensions>
</build>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
</project>
Tell Eclipse to use Maven dependencies by right-clicking on your Project folder and selecting
Configure > Convert to Maven Project.
It seems that even after running mvn eclipse:eclipse, you must do this manually to get Eclipse to actually let Maven take care of your dependencies.
If you don't see this option you may not have the M2Eclipse plugin installed in your Eclipse...