How to add directory to a classpath , I am trying to register IGLOBAL Extension in spock - automated-tests

How to add directory to a classpath ? I am trying to register IGLOBAL Extension in spock.
Not sure about the below step what exactly I should be doing:
Extensions are not discovered automatically, you must create a special org.spockframework.runtime.extension.IGlobalExtension file under META-INF/services directory on the CLASSPATH (of course it can be in a different JAR). The content of that file is simply a fully qualified name of the extension class
I am not sure how to add the file on the classpath

Related

How to upload dependencies jar in lib folder in apigee from Edge UI

I created one jar file and in that i have class files, .classpath file, .project file In sample on github, i see apiproxy, callout and lib folder. when i deploy it, i getting error that traffic can't flow , i get error like traffic.How to upload dependencies jar in lib folder However when i upload my main jar file in resources folder, i don't see any lib folder for dependencies jars. Should i place all jars in one resources folder. in my .classpath file, i can see all lib jars like message-flow-1.0.0.jar, expressions-1.0.0.jar and itextpdf-5.5.6.jar. However in documentation, its given to deploy by maven but i don't know maven, from UI how should i create lib folder and upload jars there.
Okay, in my understanding of your point.
You can upload jar file into apigee from Scripts > import file > in file type choose "JAR" > select jar file from your work space > and finally, define your jar name and then use policy Java Callout to call your jar.
If you have to modified your jar and want to deploy it, delete your existing jar in apigee and upload the new jar by following 1. In case of new jar has the same name of existing jar, you do not need to do anything with Java Callout policy. But the new jar has the different name, don't forget to modified Java Callout for refer to your new jar.
Please create the single jar file which contains jars like message-flow-1.0.0.jar, expressions-1.0.0.jar and itextpdf-5.5.6.jar. As per the apigee doc in create a Java Callout policy and make sure you have mentioned the package name & class name in Java Callout Poliy
<ClassName>package.ClassName</ClassName
<ResourceURL>java://SingleJar.jar</ResourceURL>

How to change destination jar directory

How to change destination directory of jars getting downloaded by sbt in libraryDependencies.
I want to change it to some thing like $HOME/custom_jars rather than its default one ($HOME/.ivy2/....)
Thanks,
Abhinandan
Setting retrieveManaged to true causes sbt to create a lib_managed directory in your project directory and to put your dependency jars there.
The directory name is used is controlled by managedDirectory and defaults to baseDirectory.value / "lib_managed", but you can set it to something else if you like.

Load component definition located out of bundle's jar

I need to load a component defition (xml file) from outside the jar (bundle).
I've tried to put it under:
plugins/my.bundle.name/OSGI-INF/mycomponent.xml
plugins/OSGI-INF/mycomponent.xml
And i've played with bundle's classpath too, with no luck.
Declarative Services requires the component description XML to be part of the bundle or any of its attached fragments. The Service-Component header in the bundle's manifest must reference the entry name(s) of the XML file(s).

Add external jars to Eclipse plugin classpath

In the manifest file for an eclipse plugin its possible to add jar files and
folders to the classpath (on the Runtime tab).
In the root of my plugin I have a folder lib containing a-1.0.1.jar, b-1.0.0-SNAPSHOT.jar. But only when I select each jar separately:
Bundle-ClassPath: .,
lib/a-1.0.1.jar,
lib/b-1.0.0-SNAPSHOT.jar
...can they be used inside my project. Why is it not possible to add them to the classpath by adding the common root folder only:
Bundle-ClassPath: .,
lib/
?
No, you can't. Eclipse is based on OSGi, which is the platform providing MANIFEST.MF support to build plugins.
When you set values under Bundle-ClassPath, OSGi search into each one to find class files. So you can put folders containing Java packages and class files. When you put a jar file, it is uncompressed in memory and viewed by OSGi as a regular folder, still searching for class files.
Unfortunately, there is no way to load all jar from a folder. No wildcard mechanism or something like that is allowed here.

Use in a jar a property file defined in the including war

I have a class which end up bundled in a jar.
This class (call it A) use a property file which is accessed via classA.classloader.getRessourceAsStream("META-INF/routes.conf")
there is no such file in the jar.
I want to define this file in a war which include this jar.
Is there a way to do so?
Put the file somewhere in the war where it will be on the classpath - root of the classpath would probably be easiest - (WEB-INF\classes) and access it the same way you are now, changing the path to the file to it's location relative to the root of the classpath.

Resources