How to run a snapshot plugin - maven

When I attempt to run below maven plugin using this command :
com.wordpress.pomfromjarmavenplugin:generate:0.0.1-SNAPSHOT:generatepom
I get this error :
Downloading:
https://oss.sonatype.org/content/repositories/snapshots/com/wordpress/pomfromjarmavenplugin/generate/0.0.1-SNAPSHOT/generate-0.0.1-SNAPSHOT.pom
[WARNING] The POM for
com.wordpress.pomfromjarmavenplugin:generate:jar:0.0.1-SNAPSHOT is
missing, no dependency information available [INFO]
------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO]
------------------------------------------------------------------------ [INFO] Total time: 1.862s [INFO] Finished at: Fri Nov 09 11:15:47 GMT
2012 [INFO] Final Memory: 5M/15M [INFO]
------------------------------------------------------------------------ [ERROR] Plugin
com.wordpress.pomfromjarmavenplugin:generate:0.0.1-SNAPSHOT or one of
its dependencies could not be resolved: Failed to read artifact
descriptor for
com.wordpress.pomfromjarmavenplugin:generate:jar:0.0.1-SNAPSHOT: Could
not find artifact
com.wordpress.pomfromjarmavenplugin:generate:pom:0.0.1-SNAPSHOT in
apache.snapshots
(https://oss.sonatype.org/content/repositories/snapshots/) -> [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/PluginResolutionException
Problem seems to be that all of the pom files have timestamps associated with them :
https://oss.sonatype.org/content/repositories/snapshots/com/wordpress/pomfromjarmavenplugin/generate/0.0.1-SNAPSHOT/
How can I run this plugin ? Do I need to wait until the plugin is released or somehow instruct maven to run the latest version of the snapshot ?

Add these lines to your pom:
<pluginRepositories>
<pluginRepository>
<id>oss.sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
Then your command should work:
mvn com.wordpress.pomfromjarmavenplugin:generate:0.0.1-SNAPSHOT:generatepom
Or add these lines to your pom:
<build>
<plugins>
<plugin>
<groupId>com.wordpress.pomfromjarmavenplugin</groupId>
<artifactId>generate</artifactId>
<version>0.0.1-SNAPSHOT</version>
</plugin>
</plugins>
</build>
And then issue:
mvn generate:generatepom

Related

Could not find artifact javax.xml.crypto:xmldsig

Each time when I'm trying to build the Spring application I got an error:
im#im:~/projects/nsn_maintenance_be/maintenance$ mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building maintenance 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for javax.xml.crypto:xmldsig:jar:1.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.770 s
[INFO] Finished at: 2019-05-22T19:09:32+03:00
[INFO] Final Memory: 11M/211M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project maintenance: Could not resolve dependencies for project com.ia:maintenance:war:1.0-SNAPSHOT: Failure to find javax.xml.crypto:xmldsig:jar:1.0 in http://maven.springframework.org/release was cached in the local repository, resolution will not be reattempted until the update interval of spring-maven-release has elapsed or updates are forced -> [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
the pom.xml file (repositories part):
<repositories>
<repository>
<id>spring-maven-release</id>
<name>Spring Maven Release Repository</name>
<url>http://maven.springframework.org/release</url>
</repository>
<repository>
<id>spring-maven-milestone</id>
<name>Spring Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
</repository>
<repository>
<id>spring-roo-repository</id>
<name>Spring Roo Repository</name>
<url>http://spring-roo-repository.springsource.org/release</url>
</repository>
</repositories>
I did some research and fond this lib https://mvnrepository.com/artifact/javax.xml/xmldsig/1.0 instead of javax.xml.crypto:xmldsig:jar:1.0, but I can't cut javax.xml.crypto:xmldsig:jar:1.0 from the repository. The dependencies part in my pom.xml doesn't contain javax.xml.crypto lib.
I guess that the problem is here (in this repository) http://spring-roo-repository.springsource.org/release because it returns:
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Key>release</Key>
<RequestId>C7A040F5A0227562</RequestId>
<HostId>uPDsneugMkZ3DgdU5THuUsWdaC/wEkyfgXAUPntzxdcsprT1C6M2eNgK0jo5cr2KLdNAW7uU=
</HostId>
</Error>
How can I built the application?

Error Maven with mvn test

I am using this tool for first time, and I can't build a project correctly.
when i try the life cycle commands it builds succesfully with clean validate and compile. but when i try mvn test, it gives me this error :
[INFO] ---------------------------------------------------------------------
---
[INFO] BUILD FAILURE
[INFO] ---------------------------------------------------------------------
---
[INFO] Total time: 4.410 s
[INFO] Finished at: 2018-05-25T11:33:07+02:00
[INFO] ---------------------------------------------------------------------
---
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-
plugin:2.20.1:test (default-test) on project gdp: Execution default-test of
goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.
:NullPointerException
-> [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/PluginExecutionException
mvn -v 3.5.3
i am using a proxy and i did configure settings.xml file
Please help.
thank you
Change the version of maven-surefire-plugin via:
<project>
.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

sonar:sonar not working in jenkins maven build

I have a jenkins build, how should call the sonar plugin. But every time i get the error:
Downloaded: http://xxxx:8081/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar (165 KB at 20577.1 KB/sec)
[INFO] SonarQube version: 5.6.1
Downloading: http://talas:8081/nexus/content/groups/public/org/codehaus/sonar/sonar-maven3-plugin/5.6.1/sonar-maven3-plugin-5.6.1.pom
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/sonar/sonar-maven3-plugin/5.6.1/sonar-maven3-plugin-5.6.1.pom
[WARNING] The POM for org.codehaus.sonar:sonar-maven3-plugin:jar:5.6.1 is missing, no dependency information available
Downloading: http://xxxx:8081/nexus/content/groups/public/org/codehaus/sonar/sonar-maven3-plugin/5.6.1/sonar-maven3-plugin-5.6.1.jar
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/sonar/sonar-maven3-plugin/5.6.1/sonar-maven3-plugin-5.6.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:53 min
[INFO] Finished at: 2016-09-13T12:42:59+02:00
[INFO] Final Memory: 58M/1705M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.2:sonar (default-cli) on project Core: Can not execute SonarQube analysis: Plugin org.codehaus.sonar:sonar-maven3-plugin:5.6.1 or one of its dependencies could not be resolved: Could not find artifact org.codehaus.sonar:sonar-maven3-plugin:jar:5.6.1 in server0001 (http://xxx:8081/nexus/content/groups/public/) -> [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
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
in my pom.xml i use the dependency:
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>5.1</version>
</plugin>
I do not understand, why maven uses an other plugin than this which is included as dependency.
The Jenkins Job calls the following Targets:
clean
compile
sonar:sonar
-Dsonar.jdbc.url=jdbc:oracle:thin:#oracle11db:1521/orcl
-Dsonar.host.url=http://192.168.0.100:9000
I use Jenkins Version 2.21.
SonarQube scanner 2.6.1 is configured in global configuration
I also tried to call
org.codehaus.mojo:sonar-maven-plugin:2.3:sonar
directly. but it needs java8 and my Project was build with Java7
have you tried using the plugin from org.codehaus.mojo?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.3</version>
</plugin>
Source:
http://docs.sonarqube.org/display/HOME/Frequently+Asked+Questions

Dependencies are resolved only on my mac machine and not on the Windows one for the same project

I have a couple of dependencies that resolve when I use IntelliJ Idea with my mac machine but for some strange reason they cannot be resolved when I am running the same project with IntelliJ Idea again on my windows machine.
Here are the two dependencies:
<dependencies>
<dependency>
<groupId>com.opengamma.platform</groupId>
<artifactId>og-client</artifactId>
<version>2.1.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.opengamma.platform</groupId>
<artifactId>og-server</artifactId>
<version>2.1.0</version>
<type>pom</type>
</dependency>
</dependencies>
I even tried to run mvn clean install on the project directory on the windows machine and the build stops with this error:
[WARNING] The POM for com.opengamma.platform:og-client:pom:2.1.0 is missing, no
dependency information available
Downloading: http://repo.maven.apache.org/maven2/com/opengamma/platform/og-serve
r/2.1.0/og-server-2.1.0.pom
[WARNING] The POM for com.opengamma.platform:og-server:pom:2.1.0 is missing, no
dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.611 s
[INFO] Finished at: 2014-07-26T22:03:08+02:00
[INFO] Final Memory: 8M/115M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Project3: Could not resolve dependenci
es for project com.skiabox.apps:Project3:jar:1.0-SNAPSHOT: The following artifac
ts could not be resolved: com.opengamma.platform:og-client:pom:2.1.0, com.openga
mma.platform:og-server:pom:2.1.0: Failure to find com.opengamma.platform:og-clie
nt:pom:2.1.0 in http://repo.maven.apache.org/maven2 was cached in the local repo
sitory, resolution will not be reattempted until the update interval of central
has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException
It appears to me that you are looking for the OG dependencies in
http://repo.maven.apache.org/maven2
However, OpenGamma currently does not put their dependencies there. Instead, try looking here:
http://maven.opengamma.com/nexus/content/groups/public/
I added this to my top-level pom.xml
<repositories>
<repository>
<id>maven-opengamma</id>
<name>Public online OpenGamma repository</name>
<url>http://maven.opengamma.com/nexus/content/groups/public/</url>
</repository>
</repositories>
Hope this helps.
Eric

Maven fails to find Jive archetypes from repository when building initial jive project

I'm trying to follow the instructions as specified here: https://community.jivesoftware.com/docs/DOC-3544
For some reason when I execute:
mvn archetype:generate -e -B -DarchetypeGroupId=com.jivesoftware.maven -DarchetypeArtifactId=maven-jive-archetype -DarchetypeVersion=6.0.x-SNAPSHOT -DgroupId=com.jivesoftware.dummycustomer -DartifactId=dummyCustomerSite
It doesn't seem to be able to find the archetype.
I believe I've added all the changes I needed to my ~/.m2/settings.xml (i.e. proxy settings, profile, and jive credentials)
<?xml version="1.0"?>
<settings>
<profiles>
<profile>
<id>jive.archiva</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<repositories>
<repository>
<id>jive.internal</id>
<name>Jive's Repository</name>
<url>https://maven-secure.jivesoftware.com/archiva/repository/jive.internal</url>
</repository>
<repository>
<id>jive.snapshots</id>
<name>Jive's Repository</name>
<url>https://maven-secure.jivesoftware.com/archiva/repository/jive.snapshots</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jive.internal</id>
<name>Jive's Repository</name>
<url>https://maven-secure.jivesoftware.com/archiva/repository/jive.internal</url>
</pluginRepository>
<pluginRepository>
<id>jive.snapshots</id>
<name>Jive's Repository</name>
<url>https://maven-secure.jivesoftware.com/archiva/repository/jive.snapshots</url>
</pluginRepository>
</pluginRepositories>
<properties>
<tomcat6.home><![CDATA[/usr/local/apache-tomcat-6.0.36]]></tomcat6.home>
<cargo.wait>false</cargo.wait>
<jive.setup>true</jive.setup>
<jive.devMode>true</jive.devMode>
<pluginDirs>null</pluginDirs>
</properties>
</profile>
</profiles>
<servers>
<server>
<id>jive.internal</id>
<username>john.smith</username>
<password>password123</password>
</server>
<server>
<id>jive.snapshots</id>
<username>john.smith</username>
<password>password123</password>
</server>
<server>
<id>central</id>
<username>john.smith</username>
<password>password123</password>
</server>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.mycompany.com</host>
<port>8080</port>
<nonProxyHosts>*.mycompany.com|localhost</nonProxyHosts>
</proxy>
</proxies>
</settings>
When running, Maven says it can't find the file:
$mvn archetype:create -DarchetypeGroupId=com.jivesoftware.maven -DarchetypeArtifactId=maven-jive-archetype -DarchetypeVersion=5.0.x-SNAPSHOT -DgroupId=com.cirrus.jive -DartifactId=tap
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-archetype-plugin:2.2:create (default-cli) # standalone-pom ---
[WARNING] This goal is deprecated. Please use mvn archetype:generate instead
[INFO] Defaulting package to group ID: com.cirrus.jive
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.116s
[INFO] Finished at: Thu Apr 11 16:17:50 CDT 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:create (default-cli) on project standalone-pom: Error creating from archetype: org.apache.maven.archetype.downloader.DownloadNotFoundException: Requested com.jivesoftware.maven:maven-jive-archetype:jar:5.0.x-SNAPSHOT download does not exist. Could not find artifact com.jivesoftware.maven:maven-jive-archetype:jar:5.0.x-SNAPSHOT
[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=com.jivesoftware.maven -DartifactId=maven-jive-archetype -Dversion=5.0.x-SNAPSHOT -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=com.jivesoftware.maven -DartifactId=maven-jive-archetype -Dversion=5.0.x-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR]
[ERROR] com.jivesoftware.maven:maven-jive-archetype:jar:5.0.x-SNAPSHOT
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
[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
EDIT: After following Charlee's suggesions, I get these warnings.
[WARNING] Archetype not found in any catalog. Falling back to central repository (http://repo1.maven.org/maven2).
[WARNING] Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere.
Downloading: http://repo1.maven.org/maven2/com/jivesoftware/maven/maven-jive-archetype/6.0.x-SNAPSHOT/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/com/jivesoftware/maven/maven-jive-archetype/6.0.x-SNAPSHOT/maven-metadata.xml
...
...
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.245s
[INFO] Finished at: Fri Apr 12 10:03:30 CDT 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
It looks like it still can't find the archetype, and then goes to another repository so this isn't exactly what I want.
If I change the argument for archetype version to 5.0 (which I think what my company might want me to use). Setting DarchetypeVersion=5.0.x-SNAPSHOT gives me this (note where it says xxxx actually should say http because stackoverflow is complaining that I can't post html links due to lack of my reputation):
[WARNING] Archetype not found in any catalog. Falling back to central repository (http://repo1.maven.org/maven2).
[WARNING] Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere.
Downloading: xxxx://repo1.maven.org/maven2/com/jivesoftware/maven/maven-jive-archetype/5.0.x-SNAPSHOT/maven-metadata.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.009s
[INFO] Finished at: Fri Apr 12 10:08:44 CDT 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.jivesoftware.maven:maven-jive-archetype:5.0.x-SNAPSHOT) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.jivesoftware.maven:maven-jive-archetype:5.0.x-SNAPSHOT)
Any advice as to why I can't seem to find the 5.0.x- snapshot?
Since the profile named jive.archiva is not active by default. AFAIK, there are 2 possible ways as the following :-
1.Execute the maven by specifying the profile id.
mvn archetype:generate -e -B
-P jive.archiva
-DarchetypeGroupId=com.jivesoftware.maven
-DarchetypeArtifactId=maven-jive-archetype
-DarchetypeVersion=6.0.x-SNAPSHOT
-DgroupId=com.jivesoftware.dummycustomer
-DartifactId=dummyCustomerSite
2.Make the profile active by missing some system property.
<profiles>
<profile>
<id>jive.archiva</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>!disableJive</name>
</property>
</activation>
</profile>
</profile>
You may wondered why we not use the <activeByDefault>true</activeByDefault>. Here may be the answer
This profile will automatically be active for all builds unless another profile in the same POM is activated using one of the previously described methods.All profiles that are active by default are automatically deactivated when a profile in the POM is activated on the command line or through its activation config.
Please see further information at Introduction to Build Profiles.
I hope this may help.

Resources