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
Related
I have the following settings.xml file in my project organizationsservice:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<username>${env.MAVEN_REPO_USERNAME}</username>
<password>${env.MAVEN_REPO_PASSWORD}</password>
<id>central</id>
</server>
<server>
<username>${env.MAVEN_REPO_USERNAME}</username>
<password>${env.MAVEN_REPO_PASSWORD}</password>
<id>snapshots</id>
</server>
</servers>
<profiles>
<profile>
<id>saathratri-profile</id>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<id>central</id>
<name>default-maven-virtual</name>
<url>https://saathratri.jfrog.io/artifactory/default-maven-virtual</url>
</repository>
<repository>
<snapshots>
<updatePolicy>always</updatePolicy>
</snapshots>
<id>snapshots</id>
<name>default-maven-virtual</name>
<url>https://saathratri.jfrog.io/artifactory/default-maven-virtual</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>saathratri-profile</activeProfile>
</activeProfiles>
</settings>
I include the following in my pom.xml:
...
<dependencies>
<dependency>
<groupId>com.saathratri.organizations.domain</groupId>
<artifactId>saathratri-organizations-domain</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
...
However, when I run the following command mvn -s settings.xml dependency:list, only the maven-metadata.xml file is downloaded. The saathratri-organizations-domain-2.0-SNAPSHOT.jar nor the
saathratri-organizations-domain-2.0-SNAPSHOT.pom are not downloaded.
See below output from the command:
➜ organizationsservice git:(master) ✗ mvn -s settings.xml dependency:list
[INFO] Scanning for projects...
[INFO]
[INFO] ---------< com.saathratri.organizations:organizationsservice >----------
[INFO] Building Organizationsservice 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from snapshots: https://saathratri.jfrog.io/artifactory/default-maven-virtual/com/saathratri/organizations/domain/saathratri-organizations-domain/2.0-SNAPSHOT/maven-metadata.xml
Downloaded from snapshots: https://saathratri.jfrog.io/artifactory/default-maven-virtual/com/saathratri/organizations/domain/saathratri-organizations-domain/2.0-SNAPSHOT/maven-metadata.xml (376 B at 565 B/s)
INFO]
[INFO] --- maven-dependency-plugin:2.8:list (default-cli) # organizationsservice ---
[INFO]
[INFO] The following files have been resolved:
[INFO] org.springframework.boot:spring-boot-starter-oauth2-client:jar:2.4.4:compile
[INFO] org.junit.jupiter:junit-jupiter-engine:jar:5.7.1:test
...
Please advise why the pom and jar are not being downloaded.
Thanks and Happy Father's Day to all dads.
Edit1: The Artifactory URL:
https://saathratri.jfrog.io/artifactory/default-maven-local/com/saathratri/organizations/domain/saathratri-organizations-domain/2.0-SNAPSHOT/``` has the following contents:
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/c9Qwj.png
Edit2:
mvn -s settings.xml dependency:list
[INFO] Scanning for projects...
...
Downloading: http://repository.jboss.org/nexus/content/groups/public/jboss/web/servlet-api/2.1.0.GA/servlet-api-2.1.0.GA.pom
Downloaded: http://repository.jboss.org/nexus/content/groups/public/jboss/web/servlet-api/2.1.0.GA/servlet-api-2.1.0.GA.pom (195 B at 0.2 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/jboss/web/servlet-api/2.1.0.GA/servlet-api-2.1.0.GA.jar
Downloaded: http://repository.jboss.org/nexus/content/groups/public/jboss/web/servlet-api/2.1.0.GA/servlet-api-2.1.0.GA.jar (84 KB at 90.8 KB/sec)
Are the pom and jar actually present in the correct place in your jfrog?
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>
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 following .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
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<repositories>
<repository>
<id>jboss-ga-repository</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jboss-ga-plugin-repository</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
When I try run mvn install against my project it says:
[INFO] Unable to find resource 'org.jboss.bom.eap:jboss-javaee-6.0-with-tools:pom:6.4.0.GA' in repository central (https://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.jboss.bom.eap:jboss-javaee-6.0-with-tools
Reason: POM 'org.jboss.bom.eap:jboss-javaee-6.0-with-tools' not found in repository: Unable to download the artifact from any repository
org.jboss.bom.eap:jboss-javaee-6.0-with-tools:pom:6.4.0.GA
from the specified remote repositories:
central (https://repo1.maven.org/maven2)
for project org.jboss.bom.eap:jboss-javaee-6.0-with-tools
But it tried only central (https://repo1.maven.org/maven2). Why did it ignore repositories specified in settings.xml?
Profiles need to be activated in your Maven build. There are several ways to activate them (see http://maven.apache.org/guides/introduction/introduction-to-profiles.html). For example, you can activate it at the command line using:
mvn ... -Pprofile-1
But obviously you'll need to declare the profile ID in the <profile> node that you showed.
Even after wiping out my settings.xml, I still get this error when trying to use this snapshot dependency. Given the dependency:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<path>/licensing</path>
<tomcatWebXml>${basedir}/src/main/mock/web.xml</tomcatWebXml>
</configuration>
</plugin>
And (in the POM), the plugin repository definition:
<pluginRepository>
<id>Codehaus Snapshots</id>
<url>http://snapshots.repository.codehaus.org</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled> <!-- Workaround for MNG-2974, see note below -->
</releases>
</pluginRepository>
I'm left with the following 404 error. If I actually navigate out to that repo, the jar it's looking for isn't there, just dated ones (I'm not familiar with the mechanics of how Maven ultimately resolves expected dependency names).
Ideas?
Downloading: http://snapshots.repository.codehaus.org/org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/tomcat-maven-pl
ugin-1.0-SNAPSHOT.jar
[INFO] Unable to find resource 'org.codehaus.mojo:tomcat-maven-plugin:maven-plugin:1.0-SNAPSHOT' in repository Codehaus
Snapshots (http://snapshots.repository.codehaus.org)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to downl
oad the artifact from any repository
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.codehaus.mojo -DartifactId=tomcat-maven-plugin -Dversion=1.0-SNAPSHOT -Dpacka
ging=maven-plugin -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.codehaus.mojo -DartifactId=tomcat-maven-plugin -Dversion=1.0-SNAPSHOT -Dpackagi
ng=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
org.codehaus.mojo:tomcat-maven-plugin:maven-plugin:1.0-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
Codehaus Snapshots (http://snapshots.repository.codehaus.org)
org.codehaus.mojo:tomcat-maven-plugin:maven-plugin:1.0-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
Codehaus Snapshots (http://snapshots.repository.codehaus.org)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Jan 06 10:06:49 EST 2010
[INFO] Final Memory: 14M/36M
[INFO] ------------------------------------------------------------------------
I rechecked and, with the following pom fragments:
<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/maven-v4_0_0.xsd">
...
<pluginRepositories>
<pluginRepository>
<id>Codehaus Snapshots</id>
<url>http://snapshots.repository.codehaus.org/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled> <!-- Workaround for MNG-2974, see note below -->
</releases>
</pluginRepository>
</pluginRepositories>
...
<build>
<finalName>my-webapp</finalName>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
</plugin>
...
</plugins>
...
</build>
</project>
The SNAPSHOT of the plugin has been downloaded successfully:
$ mvn clean
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building my-webapp Maven Webapp
[INFO] task-segment: [clean]
[INFO] ------------------------------------------------------------------------
[INFO] snapshot org.codehaus.mojo:tomcat-maven-plugin:1.0-SNAPSHOT: checking for updates from Codehaus Snapshots
[INFO] snapshot org.codehaus.mojo:tomcat-maven-plugin:1.0-SNAPSHOT: checking for updates from maven2-repository.dev.java.net
Downloading: http://snapshots.repository.codehaus.org//org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/tomcat-maven-plugin-1.0-20091222.232027-11.pom
5K downloaded (tomcat-maven-plugin-1.0-20091222.232027-11.pom)
Downloading: http://snapshots.repository.codehaus.org//org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/tomcat-maven-plugin-1.0-20091222.232027-11.jar
48K downloaded (tomcat-maven-plugin-1.0-20091222.232027-11.jar)
[INFO] [clean:clean {execution: default-clean}]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Wed Jan 06 16:13:28 CET 2010
[INFO] Final Memory: 7M/78M
[INFO] ------------------------------------------------------------------------
It's very weird because I can't see any difference, but things are working as expected. In other words, I can't reproduce...
In your local repository, do you have maven-metadata*.xml files in the 1.0-SNAPSHOT directory for the tomcat-maven-plugin artifact? Do they match the ones on the remote server? Do they correctly specify the build number and timestamp?
If they are incorrect locally, running maven with -U might help.
You might also check mvn help:effective-pom and see what Maven thinks the updatePolicy is for snapshots on that repository.
Or maybe just delete your tomcat-maven-plugin artifact from your local repository and try again.
If nothing helps, try to install it manually (download the plugin from the repository and use the mvn install:install-file mojo) or checkout the sources from the VCS and build it locally. But these options are just workarounds, you have a problem somewhere (what version of maven are you using?).
I know this post is a little old, but the tomcat maven plugin has been moved to the apache maven repository. Codehaus only hosts version 1.0 of the plugin. If you want 2.0-snapshot (so you can run tomcat 7), you need to change your pom.xml a little bit. Note that 2.0 is under development.
<repositories>
...
<repository>
<id>people.apache.snapshots</id>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
And your plugin configuration goes like this:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
</plugin>
Not sure exactly, but looks like they might be using some form of the "buildnumber" maven plugin to include version control revision numbers.
Take a look at http://snapshots.repository.codehaus.org//org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/maven-metadata.xml and you'll notice that in addition to the normal stuff, theres a xml tag for buildnumber and timestamp.
This may not be ideal, but you might be able to replace:
<version>1.0-SNAPSHOT</version>
with:
<version>1.0-20091222.232027-11</version>
To at least get up and running with the latest version of the plugin.
First off let me say that you do not download the TomCat-Maven-Plugin for Eclipse like other Eclipse plugins.
You simply use the maven tools in Eclipse, to insert the correct maven plugin build commands into your maven pom.xml file.....
If anyone is having trouble understanding how to get their Maven project to run as a maven Build configuration, there are a couple of things you may need to look for:
I would like to upload an image but oh well....
In your Eclipse Web App, hopefully you have a Maven POM.xml file, if not you need to set that up first.
Then, you can right click on it and then find Maven in your menu, then the sub menu item comes up, with a choice called Add Plugin.
There is a field called "Enter groupId, artifactId or sha1, etc....
Type in the word Tomcat there.
It will then load search results in the box below.
Basically what this does is load details in your pom.xml as to which plugins to download when building with Maven.
After that you need to do the Maven build.
Then, you want to go to Run Configurations and make sure you have the correct path to where your webapp lives.
Also in that page, under goals type TomCat:run
Then apply
Finally run.
If all goes well you will have a Tomcat server running the web app.
Then you can go to a browser and enter [http://localhost:8080/webappname/defaultpagename]
and walla!