I have always gotten my dependencies from http://mvnrepository.com. Has worked every time. But I can't seem to get wss4j working. My POM is like this:
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j</artifactId>
<version>2.1.3</version>
</dependency>
</dependencies>
I can get the Spring just fine, but I keep getting the "Can't find dependency" error. I even use the -U option and I get this:
Downloading: http://repo1.maven.org/maven2/org/org/apache/wss4j/wss4j/2.1.3/wss4j-2.1.3.jar
Downloading: https://repo.maven.apache.org/maven2/org/apache/wss4j/wss4j/2.1.3/wss4j-2.1.3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.411s
[INFO] Finished at: Sat Oct 10 14:31:51 EDT 2015
[INFO] Final Memory: 9M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project crypt.lib: Could not resolve dependencies for project mmaceachran:crypt.lib:jar:0.0.1-SNAPSHOT: Could not find artifact org.apache.wss4j:wss4j:jar:2.1.3 in mvnrepository (http://repo1.maven.org/maven2/org/) -> [Help 1]
But there is is downloading!!! What am I doing wrong?
UPDATE:
I used the -e option and I see that it can't find the artifact:
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact org.apache.wss4j:wss4j:jar:2.1.3 in central (https://repo.maven.apache.org/maven2)
but it is clearly there: http://repo1.maven.org/maven2/org/apache/wss4j/wss4j/2.1.3/
Starting from WSS4J 2.x, the org.apache.wss4j/wss4j module is just used as part of the website generation. The dependency you probably want is org.apache.wss4j/wss4j-ws-security-dom.
Colm.
No, it isn't there: The artifact you declared in your pom has no <type>. i.e.: by default, Maven assumes a jar type. Look in URL you posted and realise there is no .jar artifact.
Surely you need to specify a type=pom.
Related
Maven is not able to download mysql connector 8.0.12 from central, showing the below error:
Downloading: https://repo.maven.apache.org/maven2/mysql/mysql-connector-
java/8.0.12/mysql-connector-java-8.0.12.pom
[INFO] ---------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ---------------------------------------------------------------------
[INFO] Total time: 3.642 s
[INFO] Finished at: 2018-08-21T00:22:03+05:30
[INFO] Final Memory: 10M/113M
[INFO] ---------------------------------------------------------------------
[ERROR] Failed to execute goal on project OneSolution: Could not resolve
dependencies for project OneSolution:OneSolution:jar:1.1.1: Failed to
collect dependencies at mysql:mysql-connector-java:jar:8.0.12: Failed to
read artifact descriptor for mysql:mysql-connector-java:jar:8.0.12: Could
not transfer artifact mysql:mysql-connector-java:pom:8.0.12 from/to central
(https://repo.maven.apache.org/maven2): Received fatal alert:
protocol_version -> [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.
any help is appreciated, not getting enough suggestion online, trying here.
Solution 1: Try mvn clean install in console.
Solution 2: It might happen because of the firewall on your computer. Turn off the firewall and try it again.
Solution 3: Check if your pom.xml has similar dependency.
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
</dependency>
If you are using intelliJ idea there is also an other option:
In the Maven tool window, click The Toggle Offline Mode button.
This will append the --offline option to all Maven commands that IntelliJ IDEA runs. It will also report any items that cannot be found in the local repository.
Or in Maven settings.xml:
<offline>false</offline>
Use this way in maven :
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
</dependency>
I have successfully installed a JAR into the Maven local repository. I edit my pom.xml to include these lines:
<dependency>
<groupId>org.jcrontab</groupId>
<artifactId>jcrontab</artifactId>
<version>4.0.0</version>
<scope>system</scope>
<systemPath>[somepath]/jcrontab-4.0.0.jar</systemPath>
</dependency>
But, after installing with install:install-file, I think these lines are redundant. I just use them to install and when I want to "use" the jar, they are useless because the jar is in the local repo.
So I changed them to:
<dependency>
<groupId>org.jcrontab</groupId>
<artifactId>jcrontab</artifactId>
<version>4.0.0</version>
</dependency>
The same form as those dependencies that exist in the remote Maven central repo. But now Eclipse complains about:
missing artifact: org.jcrontab:jcrontab:jar:4.0.0
And in the Maven dependencies library in Java Build path, I see red cross on the jar, saying:
jcrontab-4.0.0.jar - D:\desarrollo\eclipse-jee-mars-x86_64\eclipse\${maven.home}\m2\repository\org\jcrontab\jcrontab\4.0.0 (missing)
Under this dir, I only see:
jcrontab-4.0.0.jar.lastUpdated jcrontab-4.0.0.pom.lastUpdated
And no jar is there. But other dependencies jars in this Eclipse repo are in their places.
As I examine my maven home repo (<maven-installation-dir>/m2/repository), the jar is installed there. But in the repo under Eclipse dir, the jar is missing.
I am confused.
If the installation of external jar generates a JAR under Maven installation repo, why does Eclipse "Maven dependencies" library points to a repo under Eclipse dir? The {$maven.home} directory smells bad to me.
Am I supposed to change the dependencies of local installed jars like what I did?
As suggested, I execute the command of install:install-file, and I get:
C:\Windows\System32>mvn install:install-file -Dfile="D:\desarrollo\Java environment\lib\jcrontab-4.0.0.jar" -DgroupId=org.jcronta
b -DartifactId=jcrontab -Dversion=4.0.0 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) # standalone-pom ---
[INFO] Installing D:\desarrollo\Java environment\lib\jcrontab-4.0.0.jar to D:\desarrollo\Java environment\lib\Maven\apache-maven-3.5.0\bin\..\m2\repository\org\jcrontab\jcrontab\4.0.0\jcrontab-4.0.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.597 s
[INFO] Finished at: 2017-08-03T14:27:48+02:00
[INFO] Final Memory: 6M/114M
[INFO] ------------------------------------------------------------------------
The same form as those dependencies that exist in the remote Maven central repo.
But jcrontab doesn't exist on maven central.
See yourself on maven central: https://search.maven.org/#search|ga|1|jcrontab
So you need to install the jar into your local repository if you want to use it like another dependency. You can do that like that:
mvn install:install-file -Dfile=jcrontab-4.0.0.jar -DgroupId=org.jcrontab -DartifactId=jcrontab -Dversion=4.0.0 -Dpackaging=jar
See also the maven documentation here: https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
I've been happily developing my API in AnypointStudio (Eclipse) 6.2.2 until just now I added a JSON-to-Object transformer to a flow; now when I build mvn clean package -U
I get:
Downloading: https://repository.mulesoft.org/nexus/content/repositories/public/org/mule/extensions/mule-extensions/3.8.3/mule-extensions-3.8.3.pom
[INFO] BUILD FAILURE
[INFO] -----------------------------------------------------------------------
[INFO] Total time: 14.775 s
[INFO] Finished at: 2017-07-19T10:38:10+10:00
[INFO] Final Memory: 25M/644M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project foobar: Could not resolve dependencies for project org.foo:bar:mule:1.0.0-SNAPSHOT: Failed to collect dependencies at org.mule.modules:mule-module-json:jar:3.8.3 -> org.mule.modules:mule-module-validation:jar:3.8.3: Failed to read artifact descriptor for org.mule.modules:mule-module-validation:jar:3.8.3: Could not find artifact org.mule.extensions:mule-extensions:pom:3.8.3 in Central (http://central.maven.org/maven2/) -> [Help 1]
Can anyone suggest what's going wrong? Do I need an EE licence to use JSON-to-Object?
I found the answer to this. My POM was using Mule runtime 3.8.3
<mule.version>3.8.3</mule.version>
However, there is no release of the json module that corresponds to this release. The latest at Mulesoft Releases is 3.8.1:
https://repository.mulesoft.org/nexus/content/repositories/releases/org/mule/modules/mule-module-json/3.8.1/
So, manually changing the version of this dependency in my POM gets around the issue:
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-json</artifactId>
<version>3.8.1</version>
<scope>provided</scope>
</dependency>
I'm trying to do a release of my OSS library, but I keep running in to a strange issue with the maven-release-plugin. This used to work fine. I've probably updated either Maven or Git but I can't seem to find the right combination to get things working again for the release.
Has anyone run into this issue, and does anyone know of a solution? I'm using the Maven Shade Plugin (which is what is creating the dependency-reduced-pom.xml files in the build.)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 09:27 min
[INFO] Finished at: 2015-11-04T08:23:07-05:00
[INFO] Final Memory: 111M/1039M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.1:prepare (default-cli) on project rewrite-parent: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-add command failed.
[ERROR] Command output:
[ERROR] fatal: pathspec 'config-prettyfaces/dependency-reduced-pom.xml' did not match any files
[ERROR] -> [Help 1]
The dependency-reduced-pom.xml, as I understand it, is a temporary file used while merging dependencies into an uber-jar, and should not be committed, so I'm confused why maven is trying to add this file at all.
Thanks for any help.
I figured it out, at least a workaround:
Using 'checkModificationExcludes" configuration option of the maven-release-plugin to exclude the dependency-reduced-pom.xml seems to work around the issue, though I'm not sure this is exactly what the property was intended for (the documentation is unclear):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<checkModificationExcludes>
<checkModificationExclude>dependency-reduced-pom.xml</checkModificationExclude>
</checkModificationExcludes>
</configuration>
</plugin>
I recently added this dependency to pom.xml
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.4.0</version>
</dependency>
My builds are failing in jenkins with the following error message:
[WARNING] Found duplicate resources in [org.codehaus.groovy:groovy:2.3.7,org.codehaus.groovy:groovy-json:2.3.7,org.codehaus.groovy:groovy-xml:2.3.7] :
[WARNING] META-INF/groovy-release-info.properties
[JENKINS] Archiving disabled
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5:37.485s
[INFO] Finished at: Mon Mar 09 10:10:49 PDT 2015
[INFO] Final Memory: 46M/381M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving disabled
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal com.ning.maven.plugins:maven-duplicate-finder-plugin:1.0.4:check (default) on project LightmileTest: Found duplicate classes/resources -> [Help 1]
Background/Details
I had a similar issue and this threw me for a loop for a while and I started to question my maven knowledge and did some digging. If you want to learn more about duplicate finder, you can read the readme on their github: https://github.com/ning/maven-duplicate-finder-plugin
For the project I was on, I determined I could do excludes in the dependencies or add exceptions to the duplicate finder. I saw both in my project and wondered when it was appropriate to do which.
The message from the plugin helps identify where duplication resides. You'll normally see this when you try to add new dependencies. When you see that, there are two options, either exclude things from the dependencies, or create exceptions in your com.ning.maven.plugins:duplicate-finder-maven-plugin configuration.
Summary / Conclusion
Adding an exception, just ignores the problem. So the cleaner way is add the excludes in the dependencies. This way you get exactly what you expect/desire. Furthermore, going down the exception route would just add a ton of extra work that isn't really useful. So the intent of the plugin is to help you identify duplications, then try to handle them via excludes in the dependencies.
Example of How to Do Exclude
In your example/case, one of the following should work for you:
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.4.0</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-json</artifactId>
</exclusion>
</exclusions>
</dependency>
or
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.4.0</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</exclusion>
</exclusions>
</dependency>
It is likely that your new dependency is failing on this test your are doing via Maven (duplicate-finder-plugin). Run the manual check from command line (on the level of the POM file) to find out what are the offending classes:
mvn com.ning.maven.plugins:duplicate-finder-maven-plugin:1.0.4:check
Then you can either remove the dependency or configure the Maven plugin to ignore these. (config here)
dependency:analyze-duplicate Analyzes the and tags in the pom.xml and determines the duplicate declared dependencies.
mvn dependency:analyze-duplicate
What you can do is to follow the rule of scope, meaning that, separate dependencies according to their scopes, such as in your case, rest assured used for testing, why not to put it under the scope of a test:
<scope>test</scope>
Secondary, what I usually do is executing exactly same commands from Jenkins on my local machine and usually it does help, from you error log I think it is not rest assured related, so please try to run MVN goal which is on Jenkins side locally and make sure you have the same error. If not, it can be a different configuration of maven for example via settings.xml in Jenkins machine.
Use to avoid the duplicate finder.