Overriding an individual Ivy dependency - log4net

Application A uses log4net version 1.2.10.0 and is built using my CI process, and as a result, is stored in my Ivy Shared folder. (No problems here)
Application B references Application A, as well as references the newer version of log4net, namely 1.2.11.0. As the CI process resolves the dependencies into my binary folder for application B, it conflicts when trying to get versions 1.2.10.0 and 1.2.11.0 of log4net.dll.
Is there a way that I can instruct Ivy to allow it to overwrite a dependency, at an individual/per-dependency level, to get the newer version, and that it shouldn't fail the build on the arrival of this conflict?
Or, do I have to go and rebuild Application A using version 1.2.10.0 of log4net and re-release it so that Application B doesn't have issues with it's transitative dependencies?

The issue you're having is a transitive dependency conflict. One transitive dependency for Application A is conflicting with a direct dependency in Application B.
As in Maven, use the exclude tag in Application B:
<dependencies>
<dependency org="org.hibernate" name="hibernate-core" rev="3.3.1.GA" conf='..'>
<exclude name='jaas' />
<exclude name='jacc' />
</dependency>
</dependencies>
See Ivy: how do I remove transitive dependencies?.

Related

Missing artifact org.apache.ignite:ignite-hibernate_5.1:jar:2.3.0

I am trying to implement Hibernate 2nd level cache with Apache Ignite. For this, I used following maven dependency in pom.xml based on Apache Ignite official documentation. I got following exception Missing artifact org.apache.ignite:ignite-hibernate_5.1:jar:2.3.0 when I build the project. Code uploaded to github. I am using Apache Ignite 2.3.0 version. I tried other versions too and nothing worked
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-hibernate_5.1</artifactId>
<version>${ignite.version}</version>
</dependency>
ignite-hibernate module is not deployed to Maven Central due to licensing restrictions. You can either build these artifacts from source on your own, or use 3rd party repos: https://ignite.apache.org/download.cgi#3rdparty

Adding KML Library JAK

How do I add a the JAK Library to my java project so I can use it?
I Dont understand how to I acctually make it useable in my Java Porject if it is on Gittub and I dont see the Jar Files.
Can Anyone please help me with a little guidance? I've checked online and 0 videos about it so All I can ask is help from you guys.
Adding jar dependencies to a Java project depends on what build tools are used (e.g. Maven, Gradle, Ant, etc.). If you're using an IDE, the project can be created around the build artifact (pom.xml for Maven projects, build.gradle for Gradle, etc.) or explicitly add jar files to the CLASSPATH for that project.
If you have a Maven project, add this dependency to your pom.xml file:
<dependency>
<groupId>de.micromata.jak</groupId>
<artifactId>JavaAPIforKml</artifactId>
<version>2.2.1</version>
</dependency>
For Gradle project, add this to your build.gradle file:
dependencies {
compile group: 'de.micromata.jak', name: 'JavaAPIforKml', version: '2.2.1'
//...
}
Alternatively, you can manually download the jars from the official dev.java.net Maven 2 repository. Note that JAK depends on JAXB libraries so you will need them also. Review the POM for JAK for details.

Basic resources not available in Liferay 7?

I've been transitioning a portlet from Liferay 6.2 to a bundle for Liferay 7. When I deploy it, it can't load, because of a missing resource:
$ blade sh diag 1084
diag 1084
org.mycompany.caasd.portal-ldap-sync [1084]
Unresolved requirement: Import-Package: com.liferay.portal.kernel.service;
version="[1.20.0,2.0.0)"
When I use Felix Gogo shell to see what's available, I don't see any kernel bundles. Is that a bundle I should be expecting to be installed, install myself, include in my bundle, or am I just not thinking about this the right way?
The com.liferay.portal.kernel version for CE GA4 is 2.32.1. So if you were developing for CEGA4, with a gradle project, you'd configure the dependency in your project's build.gradle like this:
dependencies {
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.32.1"
}
You can find this by looking in the portal-kernel.jar file's MANIFEST/MANIFEST.MF or if you have the liferay src for your version, in any of its own modules build.gradle files. In my tomcat bundle, the portal-kernel.jar if in tomcat/lib/ext.
Unless I've misunderstood your question, that should get you what you want.
See the docs here for more information
When you build your bundle, bnd will either
inspect your classpath and detect the package versions for you
use whatever versions you manually provide in Import-Package
In your case, it seams it somehow detected that the version of com.liferay.portal.kernel.service package is 1.20.0. It therefore generated the range "equal to or greater than current version but lower than next major version" which in your case is expressed as [1.20.0,2.0.0). That may have been because you had old jar on claspath or behacause you had wrong Import-Package statement.
This may compile just fine as long as you are nor using functionality that was added/changed in the newer version. At runtime though, the actual package version is higher (something like 2.32.1) and therefore it does not meet your requirement. As OSGi runtime can not resolve your bundle requirement, the bundle is left in "istalled" state!
To solve that you have two options:
install your bundle on older Liferay version (where com.liferay.portal.kernel.service package is between 1.20.0 and 2.0.0)
recompile your bundle making sure the classpath contains only those jars in which com.liferay.portal.kernel.service package has version that will generate a version range in which you runtime package version fits.

jhipster-entity-audit #Inject issue

I am using generator-jhipster 4.0.7 and I ve created a project, and I want to create new entity with auditing. The netity is created succesfully but the audit generator is creating dependencies with #Inject, which is not a part of the current jhipster version. Does anyone know how to solve this issue?
Thanx
the simple way will be to add the javax.inject dependencies to your project i.e. pom.xml if you are having a maven project or to your build.gradle if you have a gradle project.
for maven:
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
for gradle:
compile group: 'javax.inject', name: 'javax.inject', version: '1'
You need to check if by adding this dependencies you are not getting any conflicts in your project. This is something what I can't say because I don't know what other libs are you using.

Build and include JSF taglib as jar in a Dynamic Web Project using Maven

I am working on a JSF taglib. To test it I compile it to a JAR as described here and add it manually to a Dynamic Web Project (In the WEB-INF/lib directory).
I know that this step can be automated, but I do not know how. Can anybody explain how to copy a generated jar to a second project in Eclipse?
Thanks in advance!
quite some steps to do :)
add a pom.xml into your project and follow the maven directory structure. use packaging "jar" for the taglib project. Lets assume you use groupId=com.company.taglib artifactId=company-taglib version=1.0.0-SNAPSHOT
if you do a mvn install on this project it will copy the jar into your local maven repository (usually found at ~/.m2/ - now maven can resolve the dependency on your local machine
add a pom.xml to your webproject, use packaging "war" and add the taglib project as a dependency (within <dependencies> in pom.xml).
<dependency>
<groupId>com.company.taglib</groupId>
<artifactId>company-taglib</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
Maven will resolve this dependency from your local repository. In Eclipse using the m2e Plugin it will resolve the project directly.
To "publish" the taglib.jar you need an infrastructure to share artifacts. Usually using a repository proxy (Sonatype Nexus or Artifactory). You can also use a network folder using the file:// protocol for quick startup.
In the pom.xml you need to add the <distributionManagement> section (in the taglib pom.xml) to specify the folder / proxy the artifacts are uploaded to. A mvn deploy will then build and copy the jar file for you.
Other developers need to add that location as repository in settings.xml (I dont recommend doing that in pom.xml) or if you setup a maven proxy configure a mirrorOf in settings.xml
There are archteypes available (project templates) that will help you creating initial project structures: http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
see also: http://maven.apache.org/guides/getting-started/index.html

Resources