maven-surefire-plugin dummy:dummy.jar:1.0 missing - java

I can't get my build to build successfully because the org.apache.maven.surefire:surefire-junit4:jar:2.18.1 plugin is missing the dummy.jar.
My maven downloads everything fine from my custom repository. So there is no network problem. Also, this Problem appears on different versions from maven-surefire-plugin.
Hopefully, someone can help me. I just can't figure out what the problem is.
Error:
[INFO] --------------------------------------------------------------------- ---
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.465 s
[INFO] Finished at: 2017-05-11T11:20:13+02:00
[INFO] Final Memory: 24M/262M
[INFO] --------------------------------------------------------------------- ---
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire- plugin:2.18.1:test (default-test) on project qds-mobile-selenium-tests: Unable to generate classpath: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException:
Missing:
[ERROR] ----------
[ERROR] 1) org.apache.maven.surefire:surefire-junit4:jar:2.18.1
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.surefire -
DartifactId=surefire-junit4 -Dversion=2.18.1 -Dpackaging=jar - Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the
file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.surefire -
DartifactId=surefire-junit4 -Dversion=2.18.1 -Dpackaging=jar -
Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) dummy:dummy:jar:1.0
[ERROR] 2) org.apache.maven.surefire:surefire-junit4:jar:2.18.1
[ERROR]
[ERROR] ----------
[ERROR] 1 required artifact is missing.
[ERROR]
[ERROR] for artifact:
[ERROR] dummy:dummy:jar:1.0
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] company-releases (https://company.jfrog.io/company/release-local,
releases=true, snapshots=false),
[ERROR] central (https://company.jfrog.io/company/libs-release,
releases=true, snapshots=false),
[ERROR] snapshots (https://company.jfrog.io/company/libs-snapshot,
releases=true, snapshots=true)
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
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>de.company</groupId>
<artifactId>qds-selenium-tests-sourceLab</artifactId>
<version>1.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-
8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<selenium.version>2.53.1</selenium.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>com.github.stephenc.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
<version>1.0-1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.company</groupId>
<artifactId>saucelabs-device-library</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>2.41.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>**/MobileTestSuite.class</include>
<include>**/StationaryDevicesTestSuite.class</include>
</includes>
<failIfNoTests>true</failIfNoTests>
<rerunFailingTestsCount>3</rerunFailingTestsCount>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
And my maven settings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0
http://maven.apache.org/xsd/settings-1.1.0.xsd"
xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<username>foo</username>
<password>bar</password>
<id>central</id>
</server>
<server>
<username>foo</username>
<password>bar</password>
<id>company-releases</id>
</server>
<server>
<username>foo</username>
<password>bar</password>
<id>snapshots</id>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>company-releases</id>
<name>company-releases</name>
<url>https://company.jfrog.io/company/release-local</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://company.jfrog.io/company/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://company.jfrog.io/company/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>company-releases</id>
<name>company-releases</name>
<url>https://company.jfrog.io/company/release-local</url>
</pluginRepository>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://company.jfrog.io/company/libs-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://company.jfrog.io/company/libs-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>

Maven can't find org.apache.maven.surefire:surefire-junit4:jar:2.18.1 in your custom repository. However that dependency is correct and available in the maven central. Since you've configured central to your custom repository, maven will not look for this dependency in maven central repository.
This is most likely due to a configuration error in your custom repository server or that server not having a working internet connection.
You can either try to troubleshoot your custom repository server, or change central to default maven central repository in your maven settings.xml.

Related

Could not resolve dependencies for project X Could not find artifact

I have maven project X and when I add the maven dependency below:
<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>paypal-base</artifactId>
<version>1.1.0</version>
</dependency>
the maven project fails to build. It shows the error below:
Could not resolve dependencies for project X : Could not find artifact com.paypal.sdk:paypal-base:jar:1.1.0 in central (https://company.jfrog.io/organization/libs-release) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
I checked in the following link and the jar was present. So the jar isn't missing from the dependency.
Also I have tried to run:
mvn -U clean install
And didn't resolve the issue.
Below is the configuration of the settings.xml file in the hidden folder.m2:
<?xml version="1.0"?>
<settings>
<servers>
<server>
<username>XUSER</username>
<password>XPASSWORD</password>
<id>central</id>
</server>
<server>
<username>XUSER</username>
<password>XPASSWORD</password>
<id>snapshots</id>
</server>
</servers>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>artifactory</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://company.jfrog.io/organization/libs-release</url>
</repository>
<repository>
<snapshots/>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://company.jfrog.io/organization/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://company.jfrog.io/organization/libs-release</url>
</pluginRepository>
<pluginRepository>
<snapshots/>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://company.jfrog.io/organization/libs-snapshot</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
I will appreciate any help in fixing this issue.
Kind Regards,
Rando.
P.S
I did a little experiment. Downloaded the content from link and place them on the .m2/repository/com/paypal/sdk/1.1.0 folder and the build was successful. I don't know why isn't imported automatically.
This is a quick fix to bypass the problem.
<project>
...
</dependencies>
<repositories>
<repository>
<id>mWSO2 Dist</id>
<name>WSO2 Dist</name>
<url>http://dist.wso2.org/maven2/</url>
</repository>
</repositories>
</project>
I check in the maven corporate repository and the PayPal SDK dependency was not present. After adding the PayPal SDK manually in the jfrog artifactory I removed the WSO2 Dist repository from the project pom.xml file.
This solution is better because my project is not dependent on external repository.

Deploy Maven Project to Nexus via Gitlab CICD

So my problem is the following, I have a freshly installed Nexus 3 instance running in a Docker Container inside my Portainer instance. Currently I'm developing a Java Library that I build with Maven. I want to upload my build artifacts via Gitlab CI to Nexus to store and reuse them. In the following you can find my configuration for my Java Project, Gitlab CI Script and what my Nexus looks like.
Nexus:
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>de.kryofex</groupId>
<artifactId>PluginAPI</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>14</maven.compiler.target>
</properties>
<distributionManagement>
<!--<snapshotRepository>
<id>nexus-snapshots</id>
<url>${nexus.url}/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>${nexus.url}/repository/maven-releases/</url>
</repository>-->
<repository>
<id>central</id>
<name>Central</name>
<url>${env.NEXUS_REPO_URL}central/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshots</name>
<url>${env.NEXUS_REPO_URL}snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
</dependency>
</dependencies>
.m2/settings.xml:
<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">
<servers>
<server>
<id>central</id>
<username>${env.NEXUS_REPO_USER}</username>
<password>${env.NEXUS_REPO_PASS}</password>
</server>
<server>
<id>snapshots</id>
<username>${env.NEXUS_REPO_USER}</username>
<password>${env.NEXUS_REPO_PASS}</password>
</server>
</servers>
</settings>
.gitlab-ci.yml:
image: maven
variables:
SNAPSHOT_DEPLOYMENT_REPOSITORY: ${NEXUS_REPO_URL}/repository/maven-snapshots/
RELEASE_DEPLOYMENT_REPOSITORY: ${NEXUS_REPO_URL}/repository/maven-releases/
MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode --errors --fail-at-end --show-version"
MAVEN_CLI_POST_OPTS: "-Dnexus.url=${NEXUS_REPO_URL} -Dmaven.repo.local=.m2"
cache:
paths:
- .m2/repository/
- target/
stages:
- build
- test
- package
- deploy
codebuild:
stage: build
script:
- mvn install
- mvn compile
codetest:
stage: test
script:
- mvn $MAVEN_CLI_OPTS test
- echo "The code has been tested"
codepackage:
stage: package
script:
- mvn $MAVEN_CLI_OPTS package -Dmaven.test.skip=true
- echo "Packaging the code"
artifacts:
paths:
- target/*.jar
only:
- master
codedeploy:
stage: deploy
script:
- mvn -v
- mvn $MAVEN_CLI_OPTS source:jar deploy -Dnexus_user=${NEXUS_REPO_USER} -Dnexus_pwd=${NEXUS_REPO_PWD} -DsnapshotDeploymentRepository=$SNAPSHOT_DEPLOYMENT_REPOSITORY -DreleaseDeploymentRepository=$RELEASE_DEPLOYMENT_REPOSITORY -DskipTests ${MAVEN_CLI_POST_OPTS}
- echo "installing the package in local repository"
only:
- master
When I run my pipeline with this configuration everything works fine besides the deployment. In this stage Gitlab throws an Error:
[INFO] Uploading to central: http://78.46.71.23:49155/central/de/kryofex/PluginAPI/1.0.0/PluginAPI-1.0.0.jar
[INFO] Uploading to central: http://78.46.71.23:49155/central/de/kryofex/PluginAPI/1.0.0/PluginAPI-1.0.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:08 min
[INFO] Finished at: 2020-12-27T14:58:42Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project PluginAPI: Failed to deploy artifacts: Could not transfer artifact de.kryofex:PluginAPI:jar:1.0.0 from/to central (http://78.46.71.23:49155/central/): Transfer failed for http://78.46.71.23:49155/central/de/kryofex/PluginAPI/1.0.0/PluginAPI-1.0.0.jar: Connect to 78.46.71.23:49155 [/78.46.71.23] failed: Connection timed out -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project PluginAPI: Failed to deploy artifacts: Could not transfer artifact de.kryofex:PluginAPI:jar:1.0.0 from/to central (http://78.46.71.23:49155/central/): Transfer failed for http://78.46.71.23:49155/central/de/kryofex/PluginAPI/1.0.0/PluginAPI-1.0.0.jar
What can I do to fix this Error ? I thought maybe is my URL (selfhosted Nexus) to the repository wrong or I missed some Nexus configuration. I have worked with Nexus before at my workplace but I have never configured an Nexus instance so maybe I missed something ?
THank you in advance

Spring boot maven plugin class not found

I have three maven project one is pom package and other 2 are jar packaging here is the admin-aggreagator pom
<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.sounds.bvs</groupId>
<artifactId>admin-aggregator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>../admin-lib</module>
<module>../admin-rest</module>
</modules>
<properties>
<project.build.SourceEncoding>UTF-8</project.build.SourceEncoding>
<spring-boot-version>2.0.4.RELEASE</spring-boot-version>
<spring-version>2.0.4.RELEASE</spring-version>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<start-class>com.sounds.bvs.AdminRestApp</start-class>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.sounds.bvs</groupId>
<artifactId>admin-lib</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.sounds.bvs</groupId>
<artifactId>admin-rest</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
<mainClass>${start-class}</mainClass>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven.compiler.plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showDeprication>true</showDeprication>
<showWarnings>true</showWarnings>
</configuration>
</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>
And the admin-rest pom.xml and its Main class i'm not getting as what i'm missing as the ctrl-click is navigating to respective project and type search is able to find the main class in admin-rest project ctrl+shift+T is also getting still it is showing same,
<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.sounds.bvs</groupId>
<artifactId>admin-aggregator</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>admin-rest</artifactId>
<dependencies>
<dependency>
<groupId>com.sounds.bvs</groupId>
<artifactId>admin-lib</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jetty -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
</dependencies>
</project>
The Main Class AdminRestApp.java and i'm trying to run the admin-aggregator with
mvn clean spring-boot:run
mvnw.cmd clean spring-boot:run
./mvnw spring-boot:run
but none are working
package com.sounds.bvs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class AdminRestApp {
public static void main(String[] args) {
SpringApplication.run(AdminRestApp.class, args);
}
}
and the exception i see class not found exception i tried all which were from similar topic none helped, the start-class tag is also place and hard code the full path com.sounds.bvs.AdminRestApp in mainClass still that also did not help,
i have tried changing spring boot version as well as maven compiler plugin version that also dint helped please help is need very badly.
earlier the package path was large com.sounds.bvs.admin.rest that time also same issue changed the package name also dint helped
please let me know what i'm missing thanks in advance.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] `enter code here`
[INFO] admin-aggregator
[INFO] admin-lib
[INFO] admin-rest
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building admin-aggregator 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) # admin-aggregator ---
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) > test-compile # admin-aggregator >>>
[INFO]
[INFO] <<< spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) < test-compile # admin-aggregator <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) # admin-aggregator ---
[WARNING]
java.lang.ClassNotFoundException: com.sounds.bvs.AdminRestApp
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:491)
at java.lang.Thread.run(Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] admin-aggregator ................................... FAILURE [ 42.358 s]
[INFO] admin-lib .......................................... SKIPPED
[INFO] admin-rest ......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 56.280 s
[INFO] Finished at: 2018-08-10T00:43:37+05:30
[INFO] Final Memory: 17M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) on project admin-aggregator: An exception occurred while running. com.sounds.bvs.AdminRestApp -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Adding a spring boot version solved my problem.
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.1</version>
</plugin>
</plugins>
replace with your version of spring boot in Maven Tab ->plugins
it worked for me.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
</build>
Adding ${project.parent.version} to the dependency in pom.xml solved the problem for me.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${project.parent.version}</version>
<type>maven-plugin</type>
</dependency>
Only add the version.
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${project.parent.version}</version>
Exception Error
I read here https://docs.spring.io/spring-android/docs/2.0.0.M3/reference/html/maven.html.
And followed the link: https://search.maven.org/ - typed in the search: spring-boot-maven-plugin..
And get my dependency.
And it worked for me.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.4.RELEASE</version>
<type>maven-plugin</type>
</dependency>
You have to execute the mvn spring-boot:run command from the module maven that contains the Spring Boot application (admin-rest), not from the parent module (admin-aggregator).
But you execute it from the parent module.
I deleted .m2 folder and reinstall pom.xml file and the problem was solved.
You need to add the Spring Boot version like so:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>version</version>

Can't run java tutorial of vaadin - missing class

I tried to get into Vaadin by going through the tutorial.
I did everything described there but I can't even run it without having a build failure. I created a new Maven Project and selected Vaadin as the Archetype. After that, I made a Maven install on my project that was completed successfully. From there on, I followed the tutorial and configured the debug settings and run the program in debug mode but unfortunately I got the following error and I don't know what went wrong(Figure 5-7 in the tutorial).
[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.3.9.v20160517:run (default-cli) on project app: Execution default-cli of goal org.eclipse.jetty:jetty-maven-plugin:9.3.9.v20160517:run failed: A required class was missing while executing org.eclipse.jetty:jetty-maven-plugin:9.3.9.v20160517:run: javax/servlet/http/HttpServletResponse
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.eclipse.jetty:jetty-maven-plugin:9.3.9.v20160517
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-maven-plugin/9.3.9.v20160517/jetty-maven-plugin-9.3.9.v20160517.jar
[ERROR] urls[1] = file:/C:/Users/User1/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.1.1/sisu-inject-bean-2.1.1.jar
[ERROR] urls[2] = file:/C:/Users/User1/.m2/repository/org/sonatype/sisu/sisu-guice/2.9.4/sisu-guice-2.9.4-no_aop.jar
[ERROR] urls[3] = file:/C:/Users/User1/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.jar
[ERROR] urls[4] = file:/C:/Users/User1/.m2/repository/org/sonatype/aether/aether-util/1.11/aether-util-1.11.jar
[ERROR] urls[5] = file:/C:/Users/User1/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[6] = file:/C:/Users/User1/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[7] = file:/C:/Users/User1/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[8] = file:/C:/Users/User1/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[9] = file:/C:/Users/User1/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-tools-api/3.4/maven-plugin-tools-api-3.4.jar
[ERROR] urls[10] = file:/C:/Users/User1/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[11] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-util/9.3.9.v20160517/jetty-util-9.3.9.v20160517.jar
[ERROR] urls[12] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-webapp/9.3.9.v20160517/jetty-webapp-9.3.9.v20160517.jar
[ERROR] urls[13] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-xml/9.3.9.v20160517/jetty-xml-9.3.9.v20160517.jar
[ERROR] urls[14] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-servlet/9.3.9.v20160517/jetty-servlet-9.3.9.v20160517.jar
[ERROR] urls[15] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-quickstart/9.3.9.v20160517/jetty-quickstart-9.3.9.v20160517.jar
[ERROR] urls[16] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-jaas/9.3.9.v20160517/jetty-jaas-9.3.9.v20160517.jar
[ERROR] urls[17] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-security/9.3.9.v20160517/jetty-security-9.3.9.v20160517.jar
[ERROR] urls[18] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-plus/9.3.9.v20160517/jetty-plus-9.3.9.v20160517.jar
[ERROR] urls[19] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-jndi/9.3.9.v20160517/jetty-jndi-9.3.9.v20160517.jar
[ERROR] urls[20] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-server/9.3.9.v20160517/jetty-server-9.3.9.v20160517.jar
[ERROR] urls[21] = file:/C:/Users/User1/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar
[ERROR] urls[22] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-http/9.3.9.v20160517/jetty-http-9.3.9.v20160517.jar
[ERROR] urls[23] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-io/9.3.9.v20160517/jetty-io-9.3.9.v20160517.jar
[ERROR] urls[24] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-jmx/9.3.9.v20160517/jetty-jmx-9.3.9.v20160517.jar
[ERROR] urls[25] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/jetty-annotations/9.3.9.v20160517/jetty-annotations-9.3.9.v20160517.jar
[ERROR] urls[26] = file:/C:/Users/User1/.m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar
[ERROR] urls[27] = file:/C:/Users/User1/.m2/repository/org/ow2/asm/asm/5.0.1/asm-5.0.1.jar
[ERROR] urls[28] = file:/C:/Users/User1/.m2/repository/org/ow2/asm/asm-commons/5.0.1/asm-commons-5.0.1.jar
[ERROR] urls[29] = file:/C:/Users/User1/.m2/repository/org/ow2/asm/asm-tree/5.0.1/asm-tree-5.0.1.jar
[ERROR] urls[30] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-server-impl/9.3.9.v20160517/javax-websocket-server-impl-9.3.9.v20160517.jar
[ERROR] urls[31] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-client-impl/9.3.9.v20160517/javax-websocket-client-impl-9.3.9.v20160517.jar
[ERROR] urls[32] = file:/C:/Users/User1/.m2/repository/javax/websocket/javax.websocket-api/1.0/javax.websocket-api-1.0.jar
[ERROR] urls[33] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/websocket/websocket-server/9.3.9.v20160517/websocket-server-9.3.9.v20160517.jar
[ERROR] urls[34] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/websocket/websocket-common/9.3.9.v20160517/websocket-common-9.3.9.v20160517.jar
[ERROR] urls[35] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/websocket/websocket-api/9.3.9.v20160517/websocket-api-9.3.9.v20160517.jar
[ERROR] urls[36] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/websocket/websocket-client/9.3.9.v20160517/websocket-client-9.3.9.v20160517.jar
[ERROR] urls[37] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/websocket/websocket-servlet/9.3.9.v20160517/websocket-servlet-9.3.9.v20160517.jar
[ERROR] urls[38] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/apache-jsp/9.3.9.v20160517/apache-jsp-9.3.9.v20160517.jar
[ERROR] urls[39] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/toolchain/jetty-schemas/3.1/jetty-schemas-3.1.jar
[ERROR] urls[40] = file:/C:/Users/User1/.m2/repository/org/mortbay/jasper/apache-jsp/8.0.33/apache-jsp-8.0.33.jar
[ERROR] urls[41] = file:/C:/Users/User1/.m2/repository/org/mortbay/jasper/apache-el/8.0.33/apache-el-8.0.33.jar
[ERROR] urls[42] = file:/C:/Users/User1/.m2/repository/org/eclipse/jdt/core/compiler/ecj/4.4.2/ecj-4.4.2.jar
[ERROR] urls[43] = file:/C:/Users/User1/.m2/repository/org/eclipse/jetty/apache-jstl/9.3.9.v20160517/apache-jstl-9.3.9.v20160517.jar
[ERROR] urls[44] = file:/C:/Users/User1/.m2/repository/org/apache/taglibs /taglibs-standard-spec/1.2.5/taglibs-standard-spec-1.2.5.jar
[ERROR] urls[45] = file:/C:/Users/User1/.m2/repository/org/apache/taglibs/taglibs-standard-impl/1.2.5/taglibs-standard-impl-1.2.5.jar
[ERROR] urls[46] = file:/C:/Users/User1/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: javax.servlet.http.HttpServletResponse
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>my.vaadin</groupId>
<artifactId>app</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>app</name>
<prerequisites>
<maven>3</maven>
</prerequisites>
<properties>
<vaadin.version>8.0.0</vaadin.version>
<vaadin.plugin.version>8.0.0</vaadin.plugin.version>
<jetty.plugin.version>9.3.9.v20160517</jetty.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- If there are no local customisations, this can also be "fetch" or "cdn" -->
<vaadin.widgetset.mode>local</vaadin.widgetset.mode>
</properties>
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- Exclude an unnecessary file generated by the GWT compiler. -->
<packagingExcludes>WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<!-- Comment out compile-theme goal to use on-the-fly theme compilation -->
<goal>compile-theme</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<!-- Clean up also any pre-compiled themes -->
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/VAADIN/themes</directory>
<includes>
<include>**/styles.css</include>
<include>**/styles.scss.cache</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- The Jetty plugin allows us to easily test the development build by
running jetty:run on the command line. -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.plugin.version}</version>
<configuration>
<scanIntervalSeconds>2</scanIntervalSeconds>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Vaadin pre-release repositories -->
<id>vaadin-prerelease</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<repositories>
<repository>
<id>vaadin-prereleases</id>
<url>http://maven.vaadin.com/vaadin-prereleases</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>vaadin-prereleases</id>
<url>http://maven.vaadin.com/vaadin-prereleases</url>
</pluginRepository>
<pluginRepository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
Looks like the same error
Check your version of java and maven and make sure they are compatible.
Make sure
For the Maven compilation to work you need a JDK(not JRE,by default it may point to JRE) to be configured in your Eclipse in
Window ▸ Preferences ▸ Java ▸ Installed JREs ▸ Add…​.
This step is necessary at least on Windows, if you are using a fresh installation of Eclipse or for some other reason haven’t configured a JDK to your Eclipse. The JDK by default installs to \Program Files\Java on Windows. You can make JDK the default JRE for your Eclipse.

Customise maven checkstyle plugin

I'm trying to create custom checkstyle. Already have SNAPSHOT on sonatype however the test project where I'm trying to test it on is not able to pull depencency. Error is
[INFO] Building TestProject 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-checkstyle-plugin:2.10:checkstyle (default-cli) # TestProject ---
Downloading: http://repository.apache.org/snapshots/com/novoda/novoda-checkstyle-checks/1.0-SNAPSHOT/maven-metadata.xml
Downloading: http://repository.apache.org/snapshots/com/novoda/novoda-checkstyle-checks/1.0-SNAPSHOT/novoda-checkstyle-checks-1.0-SNAPSHOT.pom
[WARNING] The POM for com.novoda:novoda-checkstyle-checks:jar:1.0-SNAPSHOT is missing, no dependency information available
Downloading: http://repository.apache.org/snapshots/com/novoda/novoda-checkstyle-checks/1.0-SNAPSHOT/novoda-checkstyle-checks-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.993s
[INFO] Finished at: Thu Aug 08 16:37:42 BST 2013
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.10:checkstyle (default-cli) on project TestProject: Execution default-cli of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.10:checkstyle failed: Plugin org.apache.maven.plugins:maven-checkstyle-plugin:2.10 or one of its dependencies could not be resolved: Could not find artifact com.novoda:novoda-checkstyle-checks:jar:1.0-SNAPSHOT in apache.snapshots (http://repository.apache.org/snapshots) -> [Help 1]
Here is project pom
<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>TestProject</groupId>
<artifactId>TestProject</artifactId>
<version>0.0.1</version>
<properties>
<checkstyle.config.location>properties/checkstyle-configuration.xml</checkstyle.config.location>
</properties>
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<dependencies>
<dependency>
<groupId>com.novoda</groupId>
<artifactId>novoda-checkstyle-checks</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Any idea why dependency plugin is not downloaded?
Solution is simple. Since it is plugin that I'm trying to fetch I need to use pluginRepositories instead of repositories
<pluginRepositories>
<pluginRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
You can see that maven is looking for the snapshot in the wrong repo http://repository.apache.org/snapshots/
Your artifact is in https://oss.sonatype.org/content/repositories/snapshots
Either the pom you are using to run is not the one that defines the sonatype <repository> or it is being overwriten. Check the effective pom in the folder where you run maven and find the definition, you will probably find it is apache.org and not sonatype's
Alternatively, it is usually not recommended to use <repository> in your poms since it makes the artifacts unusable by others that don't have access to the special repo, check this article. I prefer configuring the custom repo (sonatype snapshots) in settings.xml

Categories