Jenkins build fails when unpacking Maven - maven

I'm learning how to work with Jenkins, running it locally on my computer with Apache Tomcat. I've made a basic build for a Maven project, but bumped into a problem. The build fails because somehow it can't unpack Maven. This is the error I'm getting:
Unpacking https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip to C:\Users\Nina\.jenkins\tools\hudson.tasks.Maven_MavenInstallation\Maven on Jenkins
java.util.zip.ZipException: archive is not a ZIP archive
at org.apache.tools.zip.ZipFile.positionAtEndOfCentralDirectoryRecord(ZipFile.java:780)
at org.apache.tools.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:716)
at org.apache.tools.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:461)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:217)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:192)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:152)
at hudson.FilePath.unzip(FilePath.java:642)
at hudson.FilePath.unzip(FilePath.java:633)
at hudson.FilePath.access$200(FilePath.java:211)
at hudson.FilePath$UnzipFrom.invoke(FilePath.java:622)
at hudson.FilePath$UnzipFrom.invoke(FilePath.java:615)
at hudson.FilePath.act(FilePath.java:1075)
at hudson.FilePath.act(FilePath.java:1058)
at hudson.FilePath.unzipFrom(FilePath.java:613)
at hudson.FilePath.installIfNecessaryFrom(FilePath.java:927)
Caused: java.io.IOException: Failed to unpack https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip (9602303 bytes read of total 9602303)
at hudson.FilePath.installIfNecessaryFrom(FilePath.java:931)
Caused: java.io.IOException: Failed to install https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip to C:\Users\Nina\.jenkins\tools\hudson.tasks.Maven_MavenInstallation\Maven
at hudson.FilePath.installIfNecessaryFrom(FilePath.java:937)
at hudson.FilePath.installIfNecessaryFrom(FilePath.java:850)
at hudson.tools.DownloadFromUrlInstaller.performInstallation(DownloadFromUrlInstaller.java:77)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:69)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
at hudson.tasks.Maven$MavenInstallation.forNode(Maven.java:662)
at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:185)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1165)
at hudson.scm.SCM.checkout(SCM.java:505)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1206)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1880)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
Finished: FAILURE
I'll include the pom.xml I'm using:
<?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>be.vdab</groupId>
<artifactId>GoedeDoel</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Goede doel</name>
<description>Goede doel</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.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-thymeleaf</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>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I've tried manually installing Maven into the folder, but that doesn't seem to help. I've tried googling for existing queries of this kind of problem, but no luck. I would be very grateful if someone could point me in the right direction for a solution.

Related

Dependency activiti-spring-boot-starter not found

I'm starting the spring-boot and the activiti dependency cant' download from this repo - https://repo.maven.apache.org/maven2
The error - Could not find artifact org.activiti:activiti-spring-boot-starter:pom:unknown in central (https://repo.maven.apache.org/maven2)
<?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>[enter image description here][1]
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.10</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>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</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 shows that the version is not known:
Could not find artifact org.activiti:activiti-spring-boot-starter:pom:unknown.
You could specify a version like so:
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter</artifactId>
<version>7.1.0.M6</version>
</dependency>
Which I found here. However are you sure you have the right dependency? Looking at this guide the dependency shown is:
<dependency>
<groupId>org.activiti</groupId>
<artifactId>spring-boot-starter-basic</artifactId>
<version>${activiti.version}</version>
</dependency>
The difference being activiti-spring-boot-starter ->spring-boot-starter-basic

spring boot Maven project import error in sts

I am facing error while importing spring boot maven project in sts-4.6.0.RELEASE :
An internal error occurred during: "Importing Maven projects".
org/springframework/tooling/boot/ls/xml/XMLRootElementContentDescriber2$QualifiedElement
Java version installed in my laptop is 1.8.0_241 and maven version is 3.6.3 below is the image attached of the error which i am facing while importing spring boot project..
Below is 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 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.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.developer.app.ws</groupId>
<artifactId>mobile-app-ws</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>mobile-app-ws</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-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

why I'am getting this error? message: Could not read pom.xml, in the first line of the code

<?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.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>temp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Temp</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>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</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>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
like so
org.eclipse.core.runtime.CoreException: Could not read pom.xml at
org.eclipse.m2e.core.internal.embedder.MavenImpl.readModel(MavenImpl.java:565)
at
org.eclipse.m2e.core.internal.embedder.MavenImpl.readModel(MavenImpl.java:574)
at
org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refreshPhase2(ProjectRegistryManager.java:542)
at
org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:498)
at
org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:351)
at
org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:298)
at
org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.getProjectFacade(MavenBuilder.java:154)
at
org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:89)
at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at
org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
at
org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)
at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205)
at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245)
at
org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:300)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:359)
at
org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:382)
at
org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
at
org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused
by: org.apache.maven.model.io.ModelParseException: Duplicated tag:
'build' (position: START_TAG seen ...\n\n\t...
#65:9) at
org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:122)
at
org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:86)
at
org.eclipse.m2e.core.internal.embedder.MavenImpl.readModel(MavenImpl.java:563)
... 24 more Caused by:
org.codehaus.plexus.util.xml.pull.XmlPullParserException: Duplicated
tag: 'build' (position: START_TAG seen
...\n\n\t... #65:9) at
org.apache.maven.model.io.xpp3.MavenXpp3Reader.checkFieldWithDuplicate(MavenXpp3Reader.java:140)
at
org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseModel(MavenXpp3Reader.java:2275)
at
org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:3845)
at
org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:595)
at
org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:117)
... 26 more
The message says there's a duplicate <build> tag in your pom.xml at line 65:
Duplicated tag: 'build' (position: START_TAG seen ...\n\n\t... #65:9)
However, the pom.xml you posted is totally fine. Maybe you have another pom.xml in your project somewhere?
The pom file has an error in it. In my case, an opening tag did not match the closing tag.
I found the exact problem by creating a new java project and then copying the pom file to there. When I tried to open the pom file, Eclipse gave a message stating the exact error that was preventing the pom file from being read.

Maven fails to compile spring-boot empty project

I have downloaded a spring-boot empty project from Spring Initializr and when compiling it gives me the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project demo: There are test failures.
I've tried with both jdk 8 and 12, looks like it doesn't change anything.
Here 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
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.1.9.RELEASE</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>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-security</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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
I've already read all the similar topics here but my problem is different. I have to use Maven and have not added any plugin yet.
I've solved cleaning the Windows registry editor autorun of xampp.

What dependency is missing from this Spring Boot Application?

I would like to create a Spring boot Web application with H2 database and JPA support. But STS throws an error at pom.xml overview :
Missing artifact org.springrfamework.boot:spring-boot-test.jar:1.5.6.RELASE (Click for 49 more)
Here is my pom.xml , I have no idea what's the problem.
<?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>data-demo-CS</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.5.6.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-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</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>
Actually your ide not getting the dependency, you should clean build again and if still showing error then simply remove that dependencies from your local repository (I. e. ./.m2 if using maven) and clean build your project again then all required dependencies will be downloaded I your local.
Command mvn clean compile package install

Resources