Scala Casbah MongoDB driver - Maven error - mongodb

What is the correct way to set up Casbah MongoDB driver in Maven? I have the following error when I tried to run Maven build, I get the following error:
[ERROR] The following artifacts could not be resolved: org.mongodb:casbah_2.10:jar:2.5.1, com.novus:salat-core:jar:1.9.2: Failure to find org.mongodb:casbah_2.10:jar:2.5.1 in https://oss.sonatype.org/content/repositories/releases/ was cached in the local repository, resolution will not be reattempted until the update interval of oss-sonatype-releases has elapsed or updates are forced -> [Help 1]
I have added the maven dependency as well and the repo location, but looking at the following URL from where Maven is supposed to fetch the jar file, it seems not to be there!
https://oss.sonatype.org/content/repositories/releases/org/mongodb/casbah_2.10/2.5.1/
What is the correct way to set this up. It is damn frustrating to have so many repositories without any jar files.

The casbah main project has the pom file which describes all the dependencies. As you can see here: https://oss.sonatype.org/content/repositories/releases/org/mongodb/casbah_2.10/2.5.1/casbah_2.10-2.5.1.pom
Typically, your build tool should be able to read the pom and fetch the dependencies.

Related

JBoss Fuse Workspace Reference

I have created a JBoss Fuse Camel integration project and I can deploy it as a Profile on the Karaf Server using fabric8:deploy. The project is running fine so far.
Now I want to create a new Profile to do some other tasks. In oder to avoid double code, I wanted to create a Commons Project and add common code into this. But i cannot figure out how to add the dependency so that fabric8:deploy will still work and also deploy the commons library on BOTH profiles.
How should I add the commons project to both projects pom.xml?
I tried to add it as a normal dependency:
<dependency>
<groupId>com.my.project</groupId>
<artifactId>common-tools</artifactId>
<version>1.0.0</version>
</dependency>
but i'm getting this error when i want to deploy it via fabric8:deploy:
The POM for com.my.project:common-tools:jar:1.0.0 is missing, no dependency information available
and
Failed to execute goal on project inbound: Could not resolve dependencies for project com.my.project:inbound:bundle:1.0.1-SNAPSHOT: Failure to find com.my.project:common-tools:jar:1.0.0 in https://maven.repository.redhat.com/ga was cached in the local repository, resolution will not be reattempted until the update interval of red-hat-ga-repository has elapsed or updates are forced -> [Help 1]
The message indicates that your common-tools project could not be found in the maven repositories. Do you have it in your local maven repo? Have you done a:
mvn clean install
for the common-tools project?

Why does sbt keep downloading my snapshot dependencies?

I have an SBT project that depends on two snapshot dependencies. Every time I build it, it goes off to the remote repository to fetch the dependencies. This is true even if I set offline := true.
When I look at how it is trying to resolve the local dependencies, the build is saying it is looking in "local", i.e., ~/.ivy2/local/... -- which is a nonexistent directory.
The jars are in ~/.ivy2/cache/... and this is where SBT downloads them when it pulls the dependencies from the remote server.
I have searched my .sbt and .scala build files and the string "local" does not appear in them in connection with a repository or cache.
SBT is at version 0.13.11 building against scala 2.11.8.
Why is SBT doing this, and how can I get it to see the cached jars?
If you want to prevent SBT from trying to download from official repositories you could simply create a file project/offline-repositories:
[repositories]
mirror-central: file:////nexus/central
mirror-maven-central-org: file:////nexus/maven-central-org
...
(/nexus/central and /nexus/maven-central-org should contain a (partial) mirror of what you need offline)
Then call sbt with the sbt.repository.config property configured:
-Dsbt.override.build.repos=true \
-Dsbt.repository.config=./project/offline-repositories
For Reference:
http://www.scala-sbt.org/0.13/docs/Proxy-Repositories.html
How to prevent SBT from trying to download from official repositories?
EDIT
If you want to use your ~/.m2 cache:
[repositories]
mirror-central: file:////home/XXXXX/.m2/repository
mirror-maven-central-org: file:////home/XXXXX/.m2/repository
...
This apparently is because in my Ivy cache I had a file named ~/.ivy2/cache/com.xxx/xxx-utils/ivy-2.3.2-SNAPSHOT.xml.original , which the build was trying and failing to parse. I'm not sure where this file came from; conceivably it was put there manually ages ago.

Maven offline build fails when it encouners google guava url with invalid character

I need to make my Tycho-Maven build work in offline mode, so I can deploy it to environments with no Internet connection and let people run the build from the previously downloaded artifacts for the third party code my app depends on. The product being built is an Eclipse RCP product, using the org.eclipse.tycho:target-platform-configuration plug-in to load the dependencies from an RCP target file.
First I run mvn -Dmaven.repo.local=/some/path/ -DgeneratePom=true clean install to create the artifacts, and that build succeeds. Then when I run mvn -Dmaven.repo.local=/some/path/ -o clean install it fails because it's running in offline mode and there is no local cache available for http://download.eclipse.org/tools/cdt/releases/8.6
So then I run mvn -Dmaven.repo.local=/some/path/ dependency:go-offline to make it download all the artifacts it needs for the build, but it fails with this message:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-dependency-plugin:2.8:resolve-plugins
(resolve-plugins) on project : Nested: Could not transfer
artifact com.google.guava:guava:jar:[10.0.1,14.0.1] from/to central
(https://repo.maven.apache.org/maven2): Illegal character in path at
index 60:
https://repo.maven.apache.org/maven2/com/google/guava/guava/[10.0.1,14.0.1]/guava-[10.0.1,14.0.1].jar
Index 60 is the "[" character in the version range specifier for the guava jar. I have no idea where that URL gets created and why it's not URL-encoded. It would be nice to get the dependency:go-offline goal to complete execution, but I don't think it's the source of my problem.
The reason I say that is when I run that goal, I see this in the output
[INFO] Adding repository
http://download.eclipse.org/tools/cdt/releases/8.6 [INFO] Fetching
p2.index from http://download.eclipse.org/tools/cdt/releases/8.6/r/
(0B at 0B/s)
I don't know why it downloads 0 Bytes, but I assume this is why I can't find a cache of the CDT bundles when I try to do an offline build.
If anyone has an idea how to work around this failure, or any other approach to make an offline build work, that would be very helpful.
I created this Maven bug report in the issue tracker.
In the course of creating a stripped down project to demonstrate the problem, I discovered the cause. The presence of org.eclipse.xtend:xtend-maven-plugin in the pom was causing the problem. The plug-in is not used, and was perhaps misconfigured, per a message I saw in the build output.

Eclipse not downloading the apache jars from pom.xml

I am using Eclipse as my IDE and want to build a maven program, but I see that neither my maven clean or maven install is working
For maven clean,I get the error:- "Failed to parse plugin descriptor for
org.apache.maven.plugins:maven-clean-plugin:2.4.1 "
I also tried the help mentioned in the link
[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/PluginDescriptorParsingException
but it is not helping
Also my maven install is not working,it shows the following error:
] Failed to parse plugin descriptor for org.apache.maven.plugins:maven-resources-plugin:2.5
I had tried all the approaches mentioned in similar issues which include deleting the directories u nder .m2 folder, deleting .m2 folder, re-installing apache-maven on my system but nothing is working.
And when I run the same maven program under intelliJ, I could see the jar names but when I click on them it shows no contents which means they are not getting downloaded properly...'
So not able to work on my java maven project.Please help.
what is the fix for such environmental issues.
Even I tried re-installing eclipse, intelli J but nothing helps.
The issue got resolved by following the steps mentioned at:
https://issues.sonatype.org/browse/MVNCENTRAL-299
try to download appropriate maven version from https://maven.apache.org/download.cgi. and follow installaion steps mentioned.
set the "M2_HOME" and "MAVEN_HOME" as environment variables pointing to maven installation directory.restart your machine.
set the maven settings in eclipse through preferences tab.

Eclipse maven plugin getting HTTP 416 when retrieving jar

I'm getting this error in the eclipse logs when I use the maven integration plugin for eclipse in my project:
Build errors for transport-data; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources (default-resources) on project transport-data: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4, org.apache.maven.shared:maven-filtering:jar:1.0-beta-4, org.codehaus.plexus:plexus-interpolation:jar:1.13: Failure to transfer org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4 from/to central (http://repo1.maven.org/maven2): Failed to transfer http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar. Error code 416, Requested Range Not Satisfiable
From the browser I can access the jar but how come the plugin gets a 416 status response?
I'm using STS 2.7.2.RELEASE (Eclipse 3.6) with the Maven Integration plugin on Maven 2.2.1
and my OS is Ubuntu 10.10. If someone could please help explain this mystery to me I'd be very grateful.
Thanks!
I know that this is a very old request, but I just came across it too. What worked for me was deleting the relevant downloaded components in the .m2 repository. I figured that there may be some partially-loaded bits in there as I had used both Eclipse and command line with maven.
Hope this helps...
HTTP 416 means that the client requested only a portion of the file, but the server probably doesn't support such requests. Though I would be surprised if maven would have broken their repo webserver.
Another possibility is that you are behind a proxy which doesn't support range requests.