EhCache POM is misbehaving - java

Last month I asked this question because I couldn't get the EhCache jar to pull down into my local Maven cache using the M2E Eclipse plugin.
Now, I am trying to convert several EhCache/Terracotta POM files into Ivy XML files (using the IvyConvertPom task (which works perfectly fine for every other POM in my local repository - and there are hundreds) and it is choking, stating:
impossible convert given pom file to ivy file: java.io.IOException: Impossible to load parent for file:/C:/Users/myUser/jars/net/sf/ehcache/ehcache-terracotta-root/2.5.0/ehcache-terracotta-root-2.5.0.pom. Parent=org.terracotta.forge#forge-parent;2.3 from=C:/Users/myUser/jars\net\sf\ehcache\ehcache-terracotta-root\2.5.0\ehcache-terracotta-root-2.5.0.pom to=C:/Users/myUser/jars\net\sf\ehcache\ehcache-terracotta-root\2.5.0\ivy.xml
Could not find artifact for C:/Users/myUser\jars\net\sf\ehcache\ehcache-terracotta-root\2.5.0\ehcache-terracotta-root-2.5.0.pom
This is happening for all of the following EhCache/Terracotta artifacts:
net\sf\ehcache\ehcache-terracotta\2.4.7\ehcache-terracotta-2.4.7.pom
net\sf\ehcache\ehcache-terracotta\2.5.0\ehcache-terracotta-2.5.0.pom
net\sf\ehcache\ehcache-terracotta-root\2.4.7\ehcache-terracotta-root-2.4.7.pom
net\sf\ehcache\ehcache-terracotta-root\2.5.0\ehcache-terracotta-root-2.5.0.pom
I'm not sure if this issue is related to the issue I had last month, or if the developers over at EhCache just have a non-standard way of writing their POMs, but this is twice now where Maven (IvyConvertPom uses Maven XSLT under the hood) has choked on doing something with their jars.
Does anything jump out at anybody as being obvious? Otherwise I have to debug Ivy code, which sounds like a painful way to wrap up a Wednesday. I'll do it if I have to, but thought I'd ask here first in case I was missing something glaring.
Thanks in advance!

I think the problem is that ivy can't resolve org.terracotta.forge#forge-parent;2.3
I'm not expert in ivy or IvyConvertPom, but I think you might need to somehow compel ivy into using the terracotta maven repository:
http://repo.terracotta.org/maven2/
I think I reproduced this problem locally and ran ant with "-d" and I could see it try all the standard maven repos out there, but not all terracotta artifacts are on maven central.
I have no idea how to inform ivy about other repos though, hopefully you know that bit of the puzzle

The ehcache versions prior to 2.9.0 have declared terracotta artifacts as a managed dependency supplied by the specific maven repository.
A fix for this bug has made it to ehcache project on Feb 6, 2015 where it became a jar dependency instead.

Related

How to tell maven that I need the javafx classes?

That looks easy enough: search the net in which package they are, copy the dependency into your pom.xml and here you go!
But I didn't didn't anything that I could use as a dependency.
Not much of a surprise, other people had the same problem, and solutions can found here https://stackoverflow.com/a/29270114/4142984 in combination with https://stackoverflow.com/a/15692230/4142984 .
In other words, those solutions suggest to get the jar manually and hard-link it in you build-path. It worked, though.
But isn't maven supposed to do that?
Question is: what did I miss, to tell maven to do this.
And I'm using maven with eclipse, just in case this would make a difference.
The links you provided suggest adding a JAR to your project CLASSPATH. That's not using Maven.
If you want to have Maven manage that dependency, and it's not in a Maven Central repo, you need to do an mvn install to your enterprise or local Maven repository.
I'm not if this Maven plugin is what you need. Maybe you can consider that as well.

Uploading local maven repository to archiva

I am setting up a local repository using Apache Archiva. After setting up now I need to copy the libraries that got downloaded into my local maven repository into archiva. Currently I am manually copying it but it is very tedious process and I am planning to automate it using some scripts. Is there any better approach to do this?
I'm trying to write a plugin for this here which is able to copy jars and poms for all dependencies in all Configurations (including transitive dependencies). You might be interested in this code
Note: I've got a failing test here because I can't currently get the parent pom xml via the Gradle API's. I raised a feature request in Gradle here
There's a suggestion on the issue to use the IvyPot plugin... I haven't tried this myself but might be worth a shot.

Maven repository's issue in Intellij IDEA

I tried all the suggested solutions which found on Stackoverflow but didn't solve the issue with Maven repositories in Intellij IDEA. The problem is that I can't find needed jars in local repository, even if I update it. Central repository is impossible to be updated. Just for example: I use in web-app servlet api (jar is found in local repo but the version is 2.5), jstl and jdbc. If I don't create Maven project I just add all the external libraries to the project manually. But in the case of Maven-project I do not add nothing but try to create dependency through Alt + Ins when writing the class. Result - there are not needed jars in local repository.
What I tried:
1.Installed/deleted a couple of versions of Maven (The current is 3.2.2)
2.Defined local repository in settings.xml (the tag missed by default)
3.Updated local repository
4.Added dependency manually in pom.xml but IDEA didn't define it
Moreover, when I created a first Maven-project in IDEA according to web-app archetype it didn't have needed folders structure but started donloading the number of jars. Current version of IDEA is 13.0. If somebody faced such problem please help me to eliminate it.
But in the case of Maven-project I do not add nothing but try to
create dependency through Alt + Ins when writing the class. Result -
there are not needed jars in local repository
You actually have to perform an maven install, this downloads the jars from whereever to your local repository. Just writing the depenecy in pom, doesn't actually download them.
This is how maven works, nothing to do with intellij.

Howto resolve ranges during release with release plugin

We use maven-release-plugin to release our maven components to repository(ies). However, some of these components use ranges on some of our dependencies. We want this because some of the dependencies are released often (Snapshots are not an option)
When we use release plugin the ranges are checked into scm and deployed to our maven repo. This doesn't make any sense since unresolved pom files in the maven repository could (and will) ensure that other build change for one build to another.
We tried using release:prepare-with-pom, but the just makes a new pom file that is committed to scm (release-pom.xml). The original pom with ranges is still deployed to the repo.
As another snag we would like to keep the ranges for the next development release. So our head/trunk should not b resolved.
I have this feeling that we are going about this the wrong way.
Can anyone please help us to solve our problem? If there are other ways to do this we would appreciate your suggestions.
I have stumbled upon two known maven release plugin bugs. Please see the following bug reports:
MRELEASE-618
MRELEASE-727
These are scheduled to be release in version 2.2.3 or 2.3 of maven-release-plugin
Edit as response to posted comments:
I agree that it is not obvious why these bugs solves my problem. I'll try to elaborate.
To get the release plugin to use the resolved pom file and deploy it you need to first use release:prepare-with-pom and then release:perform. If you want perform to deploy the resolved pom file you need to set the pomFileName in config to release-pom.xml. If not it deployes the unresolved pom.xml. Deployed pom files with ranges is not a good idea. This is why the 618 is needed.
The 727 is needed because the release-pom.xml is only checked in on the tag. When doing a release:perform your tag is checked out in the target directory. Because og the bug the plugin is looking for the release-pom.xml in the module root directory and comes up empty. This could also possibly go wrong without the pomFileName config, but less likely.
Ranges is generally a bad idea in Maven because it is buggy and because Maven does not by default deploy the resolved pom files. If Maven always deployed resolved pom files ranges would be a good idea.

Where to check out SLF4J Simple?

I'm trying to check out slf4j-simple-1.6.2 from a trusted repository (preferably, SLF4J's official repo) and pull it down into an Eclipse project. I'm doing this because I need to tweak SLF4J Simple's code so that it binds to my own logging implementation.
I'm hoping there is a way to do this without having to use Maven, because I've never used Maven before and feel much more comfortable running Ant builds.
Nevertheless, I've searched SLF4J's site high and low and cannot find any trusted links to their repository.
Even once I get the project imported into Eclipse, I still need to figure out how to get it building with Ant.
Could someone please help me:
Find the repo
Confirm whether an Ant build is possible
Thanks in advance!
The zip download here also contains the sources.
The official source code repository is hosted on GitHub. However, I believe you are doing it the wrong way.
The idea of SLF4J is to have a dependency on slf4j-api and let the developer to add exactly one binding. Instead of tweaking original bindings just write your own one. Of course you can use simple binding a starting point, but modifying existing open source libraries and maintaining patched versions is a lot of work.
As you said, slf4j is present in the official Maven repository.
So basically, you have 2 simple solutions without using Maven:
Download the JAR / sources / javadocs from this Maven repository, and copy them in your own project directory.
Use Ivy. This is an extension of Ant to give a better dependencies management. It can connect to Maven repositories. So you will be able to retrieve your slf4j dependency without having to use Maven.

Categories