I've tried to run my maven based spring proyect locally with no pom modifications but it doesn't work, I got the following error (replace ${IP} with http://172.24.14.196:8888 because of my rank can't post more than 2 links):
[INFO] Scanning for projects...
Downloading: ${IP}/archiva/repository/internal/org/springframework/boot/spring-boot-starter-parent/2.0.0.BUILD-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata org.springframework.boot:spring-boot-starter-parent:2.0.0.BUILD-SNAPSHOT/maven-metadata.xml from/to archiva.central (${IP}172.24.14.196:8888/archiva/repository/internal/): Connect to 172.24.14.196:8888 [/172.24.14.196] failed: Connection timed out: connect
Downloading: ${IP}/archiva/repository/internal/org/springframework/boot/spring-boot-starter-parent/2.0.0.BUILD-SNAPSHOT/spring-boot-starter-parent-2.0.0.BUILD-SNAPSHOT.pom
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project co.com.spicy:Shapers:0.0.1-SNAPSHOT (E:\shapers\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.BUILD-SNAPSHOT from/to archiva.central (${IP}/archiva/repository/internal/): Connect to 172.24.14.196:8888 [/172.24.14.196] failed: Connection timed out: connect and 'parent.relativePath' points at no local POM # line 14, column 13 -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
It looks like the spring-boot-starter its is getting no connection from the archiva central and cannot load resources, how can I manually load this resources or what is my problem?
I'm using the same configuration given here:
https://projects.spring.io/spring-boot/
If spring-boot dependencies are missing in archiva you can download them from spring repositories.
Add this to pom.xml
<repositories>
<repository>
<id>spring-repo</id>
<name>Spring Repository</name>
<url>https://repo.spring.io/release</url>
</repository>
<repository>
<id>spring-milestone</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/libs-milestone</url>
</repository>
<repository>
<id>spring-snapshot</id>
<name>Spring Snapshot Repository</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Related
I've declared release and snapshot repositories in the parent POM so as to make them available to all child modules
Here's the parent repository tag
<repositories>
<repository>
<id>foo-releases</id>
<url>https://nexusrm.cloud.bar.com/repository/foo-releases/</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>foo-milestones</id>
<url>https://nexusrm.cloud.bar.com/repository/foo-milestones/</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<!-- bleeding edge -->
<id>foo-snapshots</id>
<url>https://nexusrm.cloud.bar.com/repository/foo-snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
We also have a mirror but that is mapped to central spring-milestones and spring-releases only
<mirrors>
<mirror>
<id>bar-maven-mirror</id>
<name>bar Hosted Maven Mirror</name>
<url>https://nexusrm.cloud.bar.com/repository/maven-public/</url>
<mirrorOf>!foo-snapshots,!foo-releases,!foo-milestones,!lp-snapshots,!lp-releases,*</mirrorOf>
</mirror>
</mirrors>
The parent POM is built and published to the foo-snapshots repository.
Problem I'm facing is that the build in my child module fails with the following error unless I copy the <repositories> tag in it. Since I've already added that tag to the Parent POM and expect to be inherited; doing this step seems redundant, however, that's when the build succeeds.
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.bar.cloud:foo-kafka-client:1.0.0-SNAPSHOT (/Users/anadimisra/code/bar/foo/libraries/foo-kafka-client/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for com.bar.cloud:foo-kafka-client:1.0.0-SNAPSHOT: Could not find artifact com.bar.cloud:foo:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM # line 5, column 13 -> [Help 2]
[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.
I have also declared the parent in kafka-client
<parent>
<groupId>com.bar.cloud</groupId>
<artifactId>foo</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
NOTE: these are all spring boot microservices, which get built in Serverless Pods on commit, hence parent and child modules are all in separate repositories and thereby adding profiles or building from parent is not the solution I'm looking for as it is not feasible in my case.
Have you tried a 'maven install' on your parent first? If it is not installed in your local maven repository, other libraries won't find it.
Also why use another versioning scheme for your parent (e.g 1.0-SNAPSHOT) than your child (e.g. 1.0.0-SNAPSHOT). I do not think that this is an error but you can also have Bugfixes in your parent project. And it's nice for the sake of consistency
I want use screen-recorder via Maven.
<dependency>
<groupId>org.monte</groupId>
<artifactId>screen-recorder</artifactId>
<version>0.7.7</version>
</dependency>
I have more one repository:
<repository>
<id>jenkins-releases</id>
<url>http://repo.jenkins-ci.org/releases/</url>
</repository>
<repository>
<id>sonatype-releases</id>
<url>https://oss.sonatype.org/content/repositories/releases</url>
</repository>
<repository>
<id>maven.oracle.com</id>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>https://maven.oracle.com</url>
<layout>default</layout>
</repository>
When I have my Maven setting.xml is it OK for me, but for other people is it KO.
21:30:45 Downloading: http://repo.jenkins-ci.org/releases/org/monte/screen-recorder/0.7.7/screen-recorder-0.7.7.pom
21:30:46
Downloading: https://oss.sonatype.org/content/repositories/releases/org/monte/screen-recorder/0.7.7/screen-recorder-0.7.7.pom
21:30:46
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/monte/screen-recorder/0.7.7/screen-recorder-0.7.7.pom
21:30:51
Downloading: https://maven.oracle.com/org/monte/screen-recorder/0.7.7/screen-recorder-0.7.7.pom
21:30:54
[INFO] ------------------------------------------------------------------------
16:30:54 [INFO] BUILD FAILURE
16:30:54 [INFO] ------------------------------------------------------------------------
21:30:54 [ERROR] Failed to execute goal on project foo: Could not resolve dependencies for project com.comp:foo:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.github.fii:fuu:jar:1.1.0 -> org.monte:screen-recorder:jar:0.7.7: Failed to read artifact descriptor for org.monte:screen-recorder:jar:0.7.7: Could not transfer artifact org.monte:screen-recorder:pom:0.7.7 from/to maven.oracle.com (https://maven.oracle.com): Not authorized , ReasonPhrase:Authorization Required. -> [Help 1]
http://repo.jenkins-ci.org/releases/org/monte/screen-recorder/0.7.7/screen-recorder-0.7.7.pom do not return a real 404:
{
"errors" : [ {
"status" : 404,
"message" : "File not found."
} ]
}
My build crashes because it tries to go to the Oracle repository but I would like this to load the jar file which is on http://repo.jenkins-ci.org/releases/org/monte/screen-recorder/0.7.7/screen-recorder-0.7.7.jar
how can I configure this?
Your build crashes, because it's trying to download pom (metadata file) for the artifact:
Could not transfer artifact org.monte:screen-recorder:pom:0.7.7
which is not located in the repository (only the .jar file resides there).
I would recommend manually downloading the artifact from https://github.com/stephenc/monte-screen-recorder
and installing it in your local repository.
Maven:
<dependency>
<groupId>com.github.stephenc.monte</groupId>
<artifactId>monte-screen-recorder</artifactId>
<version>0.7.7.0</version>
</dependency>
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.
I have this weird situation. I have an spring boot application and in that application there are some legacy jars were needed to run the application. mvn does not allow to have a lib folder. So I added the jars to the local maven repository.
This worked well (Till there are no repositories declared in the pom file) till I wanted to add, spring-batch-admin.version 2.0-BUILD-SNAPSHOT, to my project.
So, when I added this,
<repository>
<id>spring-snapshots-local</id>
<name>Spring Maven Snapshot Repository</name>
<url>https://repo.spring.io/libs-snapshot-local/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
I get good amount of Missing artifact, and also when I tried to run mvn install in command line, i get,
[ERROR] Failed to execute goal on project webapp: Could not resolve dependencies for project com.ccc.cccc-tool:webapp:war:0.0.1-SNAPSHOT: Failed to collect dependencies at com.ccj:CCjJDBC:jar:1.0: Failed to read artifact descriptor for com.ccj:CCjJDBC:jar:1.0: Could not transfer artifact com.ccc:CCjJDBC:pom:1.0 from/to spring-snapshots-local (https://repo.spring.io/libs-snapshot-local/): Failed to transfer file: https://repo.spring.io/libs-snapshot-local/com/ccj/CCjJDBC/1.0/CCjJDBC-1.0.pom. Return code is: 409 , ReasonPhrase:Conflict. -> [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 am not think of uploading these legacy jars to the maven central to get this to working. What am I doing wrong here.
Try to add the local repository into your project. For example, your have a jar file
group: com.packagename
artifactId: somejarfile
version: 2.0.0b
Then add this code into your pom.xml file:
<repositories>
<repository>
<id>localDependenciesRepo</id>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>file://${project.basedir}/src/main/resources/localDependenciesRepo</url>
</repository>
</repositories>
Then create a folder for this repository src/main/resources/localDependenciesRepo. Create a folder structure for the library: com -> packagename -> somejarfile -> 2.0.0b. "->" means new folder of course.
And put your jar file into this folder.
Don't forget to copy/create pom.xml file for your jar file. As example:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.packagename</groupId>
<artifactId>somejarfile</artifactId>
<version>2.0.0b</version>
</project>
At least I use this solution and it works perfectly.
I'm having trouble figuring out how to configure SpringSource Tool Suite's m2 plugin. In order to get maven to work from the command line, I had to point to our enterprise repository in the settings.xml file.
If I try to build inside STS, I get the following:
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/com/mycompany/maven/adp/adp-base-pom/1.0.14/adp-base-pom-1.0.14.pom
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.mycompany.edelivery:edelivery-build:current
(C:\code\workspace\edelivery-build\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not transfer artifact
com.mycompany.maven.adp:adp-base-pom:pom:1.0.14 from/to central
(http://repo1.maven.org/maven2): ConnectException and 'parent.relativePath'
points at wrong local POM # line 4,
column 11: UnresolvedAddressException -> [Help 2]
[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.
I presume that I need to tell STS where the enterprise repository is, how do I do that? The only thing I find under File -> Properties is a field for Active Maven Profiles and that didn't help.
Here is a snippet from the settings.xml file, what do I do with this information?
<profile>
<id>internal-profile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
<name>Enterprise Plugin Repository</name>
<url>http://svn01g.gdc.nwie.net/maven2/enterprise</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>internal-release</id>
<name>MyCompany Enterprise Repository</name>
<url>http://svn01g.gdc.nwie.net/maven2/enterprise</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
Assuming you're using release 0.12.1 or earlier of the m2eclipse plugin, all you should have to do is point m2eclipse to your local maven installation. Choose Window -> Preferences -> Maven -> Installations, click Add... and browse to the root of your Maven installation. Remember you need to do this again whenever you switch to a new workspace.
The repository should be specified in the POM. Then everybody can find it.