Where should I be putting the plugin dependencies in neo4j 3 (not the actual plugin jars).
In neo4j 2 there was a lib folder where the system would load the jars from but this no longer exists.
I've tried putting them in the plugin folder but then it requires me to add every dependency of the jars which becomes unmanageable and it also seems weird to have them there.
I've tried putting them in the neo4j bin directory but they aren't detected.
I've tried adding a command line argument to the vmoptions file with a wildcard pointing to a lib folder I created and this didn't work either.
Use maven shade plugin to package all the dependencies (except that one with scope test or provided) in the jar.
I think the documentation has just been updated (although I may have missed it). It says
Having built your code, the resulting jar file (and any custom dependencies) should be placed in the $NEO4J_SERVER_HOME/plugins directory. We also need to tell Neo4j where to look for the extension by adding some configuration in neo4j.conf:
So it turns out they should go in the plugins folder or you do as Daniela said and build a fat jar.
EDIT: I eventually came to the conclusion for several reasons including this one to use the server edition which has the same directory structure as the version 2.x.
Related
I have such an application with an IntelliJ-Idea IDE that has a Springboot configuration that errors out and gives the following recommendation:
The following method did not exist:
org.springframework.context.ConfigurableApplicationContext.setApplicationStartup(Lorg/springframework/core/metrics/ApplicationStartup;)V
The method's class, org.springframework.context.ConfigurableApplicationContext, is available from the following locations:
jar:file:/C:/Users/tlmitch/.m2/repository/org/springframework/spring-context/5.2.8.RELEASE/spring-context-5.2.8.RELEASE.jar!/org/springframework/context/ConfigurableApplicationContext.class
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.context.ConfigurableApplicationContext
I'm relatively new to IntelliJ-Idea and Springboot. If this were say Eclipse - I would probably just go to the Java Build Path and add the jar file that contains the class.
I'm less familiar with IntelliJ. So far if something is missing, I've just been running 'npm install' and that usually takes care of it.
Any suggestions?
Thanks much
If you've added Spring dependencies in your pom.xml file, they might be conflicting with the Spring dependencies in the lib folder in your project directory. Deleting the lib folder will fix this. (just make sure your project does not depend on other libraries in the lib folder before deleting).
As error suggests:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.context.ConfigurableApplicationContext
you need to make sure your classpath contains only one such class. You can use Navigate | Class action to see if there are multiple versions of this class exists in project and exclude the duplicated library dependency in Maven pom.xml file.
I have downloaded ojdbc14 jar from the internet and copied it to the lib folder of my maven project. Is it necessary to add dependency in pom.xml as well. Currently working without adding.
You can use tricks to manually upload a jar into the lib folder, but it does not make sense. And it would work cause the build process will just look for that jar into the lib and if found everything will compile nicely. BUT....
Maven is a useful tool that helps you handle dependencies, internal, external, third parties, any kind, it's one of his benefits, don't need anymore to look around for jars, and put them manually into the lib dir, but why? You would override one of the basic behaviour of Maven.
Maven set lots of rules to give you the ability to manage them the way you want, you have options about how to handle every single dependency of your project, you can point to a local jar within a dependency, you can set the scope of the dependency, the type you can exclude some of the inherited transitives, and so on...
But this is the standard approach for standard situation
You should simply define the dependency, maven will downloaded from the configured repo or the default one, maven central, and retrieved from your local repo if there are no updates on that artifacts all the other time you will build that artifact.
If you have issues with licenses for ojdbc14 then the solution is configure the oracle repo where you can easily download it.
I am developing a Java application in NetBeans and using maven for the dependencies. I have a bunch of jars located in a folder. These jars load other jars located in a path known to them. It seems to me that, when i load a local jar in maven, it is actually copying the jar to another location. The problem is that the moved jar can't find the other jars anymore because now the relative path to them jars is broken.
Is it possible to use maven in such way that the included jars are not moved from their original place so they can find other jars? Or if this is not possible, is there a way to give maven an entire folder that contains subfolders, and if maven moves the entire folder, it would also move all the subfolders with the jars inside them?
I am not sure if I was clear enough. I am also new to maven. It seems to me that ant is more flexible in this regard.
Edit: After reading the comments it seems I was not very clear. Basically the company I work for has two applications that share some common jars that load other jars with URLClassLoader. I don't want to distribute these common jars again, i want my second application to find and load those jars from the location where my first application has put them. I found a solution by using maven to import one jar that uses URLClassLoader with a hard-coded path to load the other jars.
I have a module which pom file contains these lines in the beginning:
<groupId>com.domain.project</groupId>
<artifactId>MyFirstProgect</artifactId>
<packaging>jar</packaging>
<version>1.2.3-snapshot</version>
After I compile this project maven will put it into the local repository (mine is situated in the C:\Users\MyUser.m2\repository, in linux it should be somewhere in /home/myUser/.m2/repository).
Afterwards I can add a dependency in the second project like this:
<dependency>
<groupId>com.domain.project</groupId>
<artifactId>MyFirstProgect</artifactId>
<version>1.2.3-snapshot</version>
</dependency>
In my case this helped me.
P.S. But this will lead the whole first project to be added as a dependency. So maybe this is not the perfect solution for you.
I am new to maven and ran into the following question/problem:
Given Hibernate as example: When I use maven, I can easily mange dependencies by including Hibernate as a dependency. The jars are manged perfectly. But Hinbernate consits of quite a lot of other (config) files that are required to get it running (like hibernate.cfg.xml).
1.) Does Maven provide any solution to also download these files (so I can use them as a basis for my additions. It would not make sense writing these complexe xmls newly from the scratch). => For Example is there "goal/target" in maven that spits out these required "relataed config" files into a specifc directory?
2.) How do you handle this case? Although I use mave, does this meand that I neverless have to download the common zip/gz Project-Files that used to contain these files? (As i did it in the past)=>So maven only manages/solves a part of the "problems" that I have in this regard.
Update: The files I am talking about are normally files I need to edit quite often (configuration files). So they are mostly not provided as a static config file inside the jars.
UPDATE 2 => Real live example: I just started to write a POM for my project and googled the dependency-names, like "hibernate-core", "hibernate-validation", "rome" (RSS Lib), "tuckey" (Rewrite Filter) and included them in my POM. Now I have all the jars downloaded via maven (great!), but however I do not have any (sample/base) config files. The Web-app can not be run...
Formerly (when I did not use maven) I downloaded the official distribution zip/gz package and they contained everything: jars and sample config files. Ok its great that maven helps me with the jars, but in the end I do have to navigate to every project webpage and also download the zip/gz distribuation package (as I did before) to only get the sample config files to include them in my project and then make some smaller changes... (without hibernate.cfg.xml hibernate does not start and writing it from scratch is an absolute nightmare, the best solution is take their sample file and update some specific stuff...
Thank you very much for any advice.
Markus
Most people handle this by including files like this inside their jars and referencing them via classpath.
If this doesn't appeal to you, and you have a bunch of them, the Maven solution is (a) use the assembly plugin to combine them into a jar or zip or tar; and attach the resulting item as an artifact with a non-empty classifier, and (b) use the maven-dependency-plugin to download the artifact and unpack it under target/something.
I need to use a xyz.jar wich was generated with ant. Hence, the transitive dependencies are missing. So I had the idea, to modify the xyz.jar to add the internal META-INF/maven/groupId/artifactId/pom.xml and pom.properties files.
When I deployed it to Artifactory, it ignored them and generated it's own pom.xml without dependencies.
What has one to do, Artifactory deploys the pom.xml lying about in the same folder as the xyz.jar file?
Lost way too much time on this allready...
Chances are that Artifactory skips the deployment of the internal POM because it cannot read the POM's physical size from the archive (done for historical reasons); You can verify this by looking at the log for a warning message along the lines of:
"Found pom.xml file with size -1 inside the zip. Ignoring"
If you've already gone to the lengths of creating a customized POM file, you can paste it's contents in the POM content editor of the artifact deployer or deploy it independently; though the first option will give you the benefit of auto detecting the deployment coordinates for the JAR file.
It might be a better idea to add it's dependencies to your pom instead of rigging a third-party library to use maven.
That being said, make sure your pom.xml is valid XML (most modern IDEs can validate xml for you) and make sure your properties file includes version, group id, and artifact id.
Artifactory has changed the way that it handles POM generation in different versions, so, depending on your version, you may have some sort of generate pom option that you have to turn off on deploy. I think they have a deploy time pom editor or something like that in the newer versions.
modify the ant that create an xyz.jar to produce runnable jar - the jar should have all its deppendencies packaged inside.(create a lib directory in your xyz project and put all the jars xyz deppends on inside this directory, then export your project to jar with all the libraries packaged inside)
good step-by-step example how to create an ant script can be found here.
good luck!