Maven artifact issue with stardog and sesame dependencies - maven

I have a program, developed in a maven project through Eclipse, that provides an ETL service which ingests data, generates turtle format RDF using the Jena API, and loads it into a triple store which requires data sent to it using the Sesame API. As such, I need to convert the statements created by the ETL service from Jena to Sesame.
I want to use the following class from Stardog, as it does precisely what I need to do. I tried to add the following dependencies to my pom.xml to resolve the issue:
<dependency>
<groupId>com.complexible.stardog.protocols.http</groupId>
<artifactId>client</artifactId>
<version>${stardog.version}</version>
<exclusions>
<exclusion>
<!-- Depends on this as if it were a jar artifact, when it is a pom -->
<artifactId>sesame</artifactId>
<groupId>org.openrdf.sesame</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.complexible.stardog.reasoning.http</groupId>
<artifactId>client</artifactId>
<version>${stardog.version}</version>
<exclusions>
<exclusion>
<!-- Depends on this as if it were a jar artifact, when it is a pom -->
<artifactId>sesame</artifactId>
<groupId>org.openrdf.sesame</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.complexible.stardog</groupId>
<artifactId>core</artifactId>
<version>${stardog.version}</version>
<exclusions>
<exclusion>
<!-- Depends on this as if it were a jar artifact, when it is a pom -->
<artifactId>sesame</artifactId>
<groupId>org.openrdf.sesame</groupId>
</exclusion>
<exclusion>
<artifactId>license</artifactId>
<groupId>com.clarkparsia</groupId>
</exclusion>
<exclusion>
<artifactId>erg</artifactId>
<groupId>com.complexible.erg</groupId>
</exclusion>
</exclusions>
</dependency>
but I get the following errors:
Missing artifact com.complexible.stardog:shared:jar 2.2.2
Missing artifact org.openrdf.sesame:sesame:jar:2.7.12
Missing artifact com.complexible.stardog:api:jar.2.2.2
I also get errors on the opening Dependency tag for the above dependencies saying that the dependency contained within it is also missing.
Note: stardog.version = 2.2.2 and sesame.version = 2.7.12.
Any ideas?

I don't really know how to help you with the maven dependency problem - this looks very specific to Stardog. If you don't get an answer here you might try asking about this on their support mailinglist instead.
However, I can offer an alternative solution: instead of using a convertor class, you just serialize the Jena objects back to N-Triples or Turtle, and then parse them using Sesame's Rio parser - which will of course create Sesame API objects.
I'm not too familiar with the Jena API but I'm sure there is a way you can write a model to, say, an OutputStream in Turtle format. Once you have that OutputStream, you can simply do something like this:
// in case of very large files, use something more efficient, like a
// PipedOutputStream, or first write back to disk
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
// parse the data using Sesame Rio, which provides a Sesame Model
// object. You can of course also immediately write the
// data to the store instead of first creating a Model.
org.openrdf.model.Model model = Rio.parse(in, "", RDFFormat.TURTLE);

Related

How does spring boot check for classes that don't exist on the classpath using conditionalonclass annotation?

Somewhere it is mentioned that asm is used behind the scenes. If anyone can point me where it is done in the framework or an example would be greatly appreciated.
Imagine the following case
dependencyA contains dependencyB
and your POM looks like the following
<dependency>
<groupId>com.company.name</groupId>
<artifactId>dependencyA</artifactId>
<version>1.1.1</version>
<exclusions>
<exclusion>
<groupId>com.company.name</groupId>
<artifactId>dependencyB</artifactId>
</exclusion>
</exclusions>
</dependency>
so you added dependencyA excluding dependencyB to your project in the other word the dependencyB is not in your classPath --> so if you used #ConditionOnClass(com.company.name.dependencyB.myService.class) it wont execute the code

Perfomance Test and API test are not working together in same framework

#ptrthomas - I am able to perform API test and performance test separate in karate. But when I try to merge both in same framework, either of them stopped working.
Reason that I can see here - karate-core is sub dependency of both karate-junit4 and karate-apache. But both of them install different version of karate-core. Hence either have to exclude one of them. But wherever you exclude it, it will stop working. If you exclude it from karate-junit4 then API test will not work, if you exclude it from karate-apache or gatling, performance will not work.
Is there any common version for dependencies for both performance and API test (which run through junit) or any github location where someone might have integrated both in one project?
Below are the version that I am using -
UTF-8 1.8 3.6.0 0.9.0.RC3 2.2.4
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit4</artifactId>
<version>0.2.7</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-core</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<version>${karate.version}</version>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-gatling</artifactId>
<version>${karate.version}</version>
<scope>test</scope>
</dependency>
Can someone please help here?
Just use this sample project: https://github.com/ptrthomas/karate-gatling-demo
This has the right dependencies set as a simple, stand-alone project and many teams have used and validated it.
If you are still facing issues, please follow the instructions here: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

Ratpack 1.5.4 hystrix dependency cannot be resolved

I cannot compile my project that uses Ratpack 1.5.4 because there is a missing dependency to Hystrix 1.5.13 which cannot be resolved.
http://search.maven.org/#search%7Cga%7C1%7Cg%3A"com.netflix.hystrix"%20AND%20v%3A"1.5.13"
What is wrong here?
You can try excluding com.netflix:hystrix-core:1.5.13 from io.ratpack:ratpack-hystrix:1.5.4 and then you can add com.netflix:hystrix-core:1.5.12 directly to your pom.xml file, something like that:
<dependencies>
<dependency>
<groupId>io.ratpack</groupId>
<artifactId>ratpack-core</artifactId>
<version>1.5.4</version>
</dependency>
<dependency>
<groupId>io.ratpack</groupId>
<artifactId>ratpack-hystrix</artifactId>
<version>1.5.4</version>
<exclusions>
<exclusion>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-core</artifactId>
<version>1.5.12</version>
</dependency>
</dependencies>
I've tested this simple Maven Ratpack "Hello, World!" app https://github.com/wololock/ratpack-maven-example
It compiles in Travis without any issue - https://travis-ci.org/wololock/ratpack-maven-example (I have com.netflix:hystrix-core:1.5.13 in my local .m2 repository, so I wanted to use something with a clean local Maven repository like Travis CI)
I don't know if version 1.5.13 got rolled back or something like that. It can be found in MvnRepository.com https://mvnrepository.com/artifact/com.netflix.hystrix/hystrix-core/1.5.13 however it says that 1.5.12 is newer, even though it got released 2 months earlier.

javax/inject/Inject.class in lib/javax.inject-1.jar is hidden by lib/javax.inject-2.5.0-b42.jar on onejar executable

I am attempting to create an atomic executable jar (i.e. no dependencies outside of the jar).
To do this I have added a com.jolira:onejar-maven-plugin in my pom.xml. This seems to do the job, but when I execute the jar I get the warnings:
JarClassLoader: Warning: Null manifest from input stream associated with: lib/javax.inject-1.jar
JarClassLoader: Warning: javax/inject/Inject.class in lib/javax.inject-1.jar is hidden by lib/javax.inject-2.5.0-b42.jar (with different bytecode)
JarClassLoader: Warning: javax/inject/Named.class in lib/javax.inject-1.jar is hidden by lib/javax.inject-2.5.0-b42.jar (with different bytecode)
It seems that my dependencies are pulling in both javax.inject-1.jar and javax.inject-2.5.0-b42.jar. To verify this I checked and both have/are being downloaded from the repository. I certainly don't have both listed in the dependencies, so there must be some implied dependency AFAICS.
Anyone know if there is a way to exclude just one jar from a maven dependency, or alternately to prevent onejar-maven-plugin from including it in the executable jar?
Is there a better way to create an atomic (or some call them fat) jar where the java loader can actually load from an embedded jar. I've tried all day with various different recipes and onejar was the only one that actually got the loaded to work.
After some playing I found Alex's solution to be correct, just that I had put the exclude in the wrong place. The solution is to put it here:
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.26</version>
<exclusions> <!-- exclude exclude javax.inject-1.jar -->
<exclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>
Just putting this here for future.
I solved the problem in this way:
(It's for project's dependency which has javax.inject in its own dependencies)
<exclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>

How do i use a "xxx-bin.tar.gz" file in a maven dependency?

i have some code that needs to work with the shibboleth codebase. The manual install steps i do are to download the shibboleth-identityprovider-2.3.5-bin.tar.gz, then extract it and do some tweaking and adding some jars that i build.
I want to do this in a maven assembly phase. However, since the binary has a "-bin" in it, i don't know what to specify in my pom.xml to download that file. In my pom i have:
<dependency>
<groupId>edu.internet2.middleware</groupId>
<artifactId>shibboleth-identityprovider</artifactId>
<version>2.3.5</version>
<type>tar.gz</type>
<exclusions>
<exclusion>
<artifactId>shibboleth-jce</artifactId>
<groupId>edu.internet2.middleware</groupId>
</exclusion>
</exclusions>
</dependency>
However, the dependency check fails (presumably because the tar file is named "shibboleth-identityprovider-2.3.5-bin.tar.gz" and not "shibboleth-identityprovier-2.3.5.tar.gz".
I'm not sure what i need to specify in my pom to use the proper tar file.

Resources