Unable to download saxon-he 9.5 with maven - maven

Maven will not retrieve saxon 9.5, because it has two conflicting dependencies on jdom.
It turns out the second dependency :
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>2.0.4</version>
<optional>true</optional>
</dependency>
should probably have "jdom2" as artifactId.
Does anyone have suggestions on how to override this?

Yes indeed you are right. I have raised this as a bug issue on the Saxon community site:
https://saxonica.plan.io/issues/2056
We will address the problem as soon as possible.

To override dependencies in maven I suggest look at the following:
Override dependencies of third party jar in maven

Related

Imported Packages : com.day.cq.wcm.api,version=[1.29,2) and org.apache.sling.api.resource,version=[2.12,3) -- Cannot be resolved

I am facing a weird issue after creating the AEM project using the archetype 24 from https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html?lang=en#available-properties
The project build successfully and deployed perfectly and somehow the osgi bundle is not "Active" because of below issue in bold: com.day.cq.wcm.api,version=[1.29,2) -- Cannot be resolved and org.apache.sling.api.resource,version=[2.12,3) -- Cannot be resolved
Imported Packages:
**com.day.cq.wcm.api,version=[1.29,2) -- Cannot be resolved**
**org.apache.sling.api.resource,version=[2.12,3) -- Cannot be resolved**
I have tried to add these dependencies in the parent pom finding in http://localhost:4502/system/console/depfinder
Somehow my efforts failed to resolve this issue, could anyone help me to resolve the issue.
thanks in advance
What you did to "solve" the issue is telling your bundle to accept any version of the packages. This very likely will cause problems later as you might get an incompatible implementation.
Instead what you should do is use the system console bundle view in AEM/sling to find out which versions of the packages are offered by the bundles. Probably the versions are lower than 1.29 and 2.12.
So the correct solution would be to use an older version of the archetype that matches the versions offered by your AEM/sling system.
Please change the language of the website to English and read the article here: https://flagtick.com/post/getting-started-with-aem-sites-setup-project-eduzone-system-part-7
It might help you a little bit.
</executions>
<dependencies>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.caconfig.bnd-plugin</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>
</plugin>
I had same problem with archetype 26.
resolved by adding this dependencies inside core/pom.xml
<!-- https://mvnrepository.com/artifact/com.day.cq.wcm/cq-wcm-api -->
<dependency>
<groupId>com.day.cq.wcm</groupId>
<artifactId>cq-wcm-api</artifactId>
<version>5.9.4</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.sling/org.apache.sling.api -->
<dependency>
<artifactId>org.apache.sling.api</artifactId>
<version>2.18.4</version>
<groupId>org.apache.sling</groupId>
<scope>provided</scope>
</dependency>

Maven dependency for UserCompatibilityHelper?

I hope to add a Maven dependency so that I can use this class in my plugin:
com.atlassian.confluence.usercompatibility.UserCompatibilityHelper
What dependency should I add?
I installed Atlassian plugin SDK 6.2.14 and it seems that it does cover this class.
I believe you can use following dependency :
<dependency>
<groupId>com.atlassian.usercompatibility</groupId>
<artifactId>usercompatibility-confluence</artifactId>
<version>2.1.4</version>
</dependency>
You can also take a look at Atlassian Documentation about it.

downloading guice3.0 artifact from maven central repository

I'm trying to upgrade my struts2 web app from guice2.0 to guice3.0.
I'm trying to test it out using maven jetty.
I've successfully upgraded my pom.xml to use the correct version and groupId for the 3.0 release, but if I call mvn jetty:run
I see that it is trying to download
guice-3.0-no_deps.jar
which throws a build error and can't be found the central repository?
I don't get this error if I don't include any guice extensions.
Any ideas?
Thanks
I posted this question also to the guice user group.
This is the answer I received.
The guice-3.0-no_deps.jar is a build-time artifact that's used to compile the extensions, but is not required at runtime - it's not on maven central because the Guice team didn't want people depending on this "uber-jar" by mistake. The extensions have an optional dependency to guice-3.0-no_deps.jar (so they can compile) but they also have a non-optional dependency to guice-3.0.jar for the runtime case.
Well-behaved maven plugins should see that the the no_deps dependency is optional and not throw a build error if it's missing, so this sounds like a bug in the jetty plugin. To workaround the Jetty bug you can explicitly hide this dependency as follows:
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-struts2</artifactId>
<version>3.0</version>
<exclusions>
<exclusion>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
</dependency>
Note that we can't do this in the original build pom because we still need the no_deps dependency when doing the original compilation.

Choosing dependency version in maven and maven plugin

I have a maven plugin which is using hsqldb 1.8.0.10. In my pom.xml from the plugin, it is declared like this:
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.10</version>
</dependency>
But if I run that plugin from another maven project, and that project has a newer version of hsqldb (for instance 1.9.0), how can I configure my plugin that he will use the newest version of hsqldb, without changing it's pom.xml?
And is it possible to do this the other way around as well? If my other maven project uses hsqldb 1.7.0 (for instance), that he will use the 1.8.0.10 version which is specified in the maven plugin itself?
I hope someone can answer my question.
Kind regards,
Walle
Your main question is possible, but it might not work properly if the plugin doesn't work with the newer code for any reason.
A plugin can have it's own personal dependencies section, and will use standard Maven dependency resolution, choosing the highest version requested. So, you can do
<plugin>
<groupId>some.group.id</groupId>
<artifactId>some.artifact.id</artifactId>
<version>someversion</version>
<dependencies>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.9.0</version>
</dependency>
</dependencies>
</plugin>
I don't think going the other way around is possible, though.
use properties place holder for the version, say ${hsqldb.version} then declare in different project pom the version you want to put in it

Cannot migrate from spring 2.5 to spring 3.0

Problem is a bit stupid but I can't find any spring3.0-with-dependencies.jar. Is it assumed that I should find all necessary dependencies by myself?
May I use dependencies from spring 2.5 in this case? UPD: answer is no, I can't. So, where are the dependencies??
I guess they don't release them any more. You can have the dependencies automatically if you use maven or ivy. All you need is to define the dependencies in your pom.xml like this:
<pom>
...
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
</dependencies>
...
</pom>
Maven will bring all the dependencies transitively.
If you are using Maven, you can get Spring 3.0 jars (and their transitive dependencies) from the central repository. Simply add this to your pom.xml:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
For more details, more artifacts, check out Obtaining Spring 3 Artifacts with Maven (and please, don't use EBR if you don't need it or I guarantee the nightmare).
Usually the readme.txt file has the dependencies listed for each module. With that you can usually get them easiest from the maven repository... or better yet, with maven (http://maven.apache.org).

Resources