File Path to jar inside another jar - file

For an Eclipse plugin, I need to refer to a jar file inside the plugin directory (to provide code to users). This works perfectly when running the plugin while developing (inside a runtime-eclipse-application).
But when I build an update site, my plugin is built into a jar file. File paths for images are still working, but when the jar should be imported, eclipse shows the following error:
Description Resource Path Location Type
The container 'DoodleDebug' references non existing library 'file:\C:\Users\Me\.eclipse\org.eclipse.platform_3.7.0_740800064\plugins\ch.unibe.scg.doodledebug_1.0.0.201208281642.jar!\DoodleDebug-Client.jar'
The outer jar path is correct and when inspecting it with WinRAR, I can see the desired jar file inside it!
Why isn't this working as expected?

You will need to install your plugin in an exploded form. To do this, in your MANIFEST.MF file, add the following line:
Eclipse-BundleShape: dir
This will ensure that your plugin is installed as a directory, not a jar file. There is no way to reference nested jars, so they must be exploded.
See here for more information: http://eclipsesource.com/blogs/2009/01/20/tip-eclipse-bundleshape/

Related

Read local asset in react-native-fs

I have a file ("static.zip") in the root directory of my react-native project that I'm trying to access it via the react-native-fs library. Given this example, I thought it would be as easy as this on iOS:
sourcePath = `${MainBundlePath}/static.zip`
RNFS.readFile(sourcePath)
However, the file does not exist on that path. When I look inside at the contents of the MainBundlePath directory, I don't see any assets in there. I also tried adding static.zip to my Xcode project, but that didn't seem to do the trick either.
Adding the zip file to my Xcode target got this to work, at least on iOS. I was unable to implement a require() solution I found here: React-Native: How to open locally bundled binary file
You should manually put the file in to iOS Resource by Xcode and Android Asset by Android Studio, then use this package to load file path https://www.npmjs.com/package/react-native-file-asset

Netbeans JSF - Creating executable JAR file

I'm working at the moment on an JSF Project project. Everything is working fine. Creating .war-file, deploying it.
What I actually want is, to create a executable JAR-file for a single Class. In this Class I have a Main-method that sends an email after executing it.
I the past I have worked with Eclipse. And that was very easy.
Now I am working with Netbeans. I have red a lot of posts with the information to clean and build the project. Next to that checking the .dist folder for the JAR-files.
I have either the .dist folder, or any JAR-files in my Project folder for that correlate file.
How can I easily create that JAR-file in Netbeans?
Assuming you are using a native NetBeans project rather than Maven:
The build artefact of a project is defined by it's project type. A JSB/Web project is always build into a WAR file.
If there is one class in your project that you want to put into a JAR file, the clean solution would be to create a new "Java" project with that class (as your class clearly has no dependencies to your Web Application this should work).
For such a project NetBeans will automatically create a runnable JAR file if you configure the main method.
In your JSF project you can simply include that project as a library. If you enable "Build projects on classpath", the jar will automatically be build when you build the web application.
Another approach would be to customize the Ant script NetBeans uses internally and add a target that builds your executable JAR file from that single class.
Details on how to customize the IDE generated Ant script can be found in the manual:
https://docs.oracle.com/netbeans/nb82/netbeans/NBDAG/create_japps.htm#CHDDAHEB

Eclipse does not recognize static web content under src/main/resources/static

I am working on a Spring boot web project. I have an index.html file under src/main/webapp, and a .js file under src/main/resources/static/js.
Eclipse is complaining on the <script></script> inclusion inside the index.html file: Undefined Javascript file.
The above is also the case for css files under src/main/resources/static/css.
In addition, I'm using wro to generate unified angularjs-bootstrap js and css files, which are generated under target\generated-resources\static and Eclipse cannot find them either.
Is there any way to configure Eclipse to include the above directories?
The javascript and css files must be placed under src/main/webapp so that they go in the correct location when the final WAR is built. Files placed under src/main/resources will be placed in the java class path of the WAR when it is deployed (i.e., under the classes directory of the WAR). You should update your project by placing css/javascript files under src/main/webapp. wro can also be configured to work properly with eclipse see: CSS and JS minification using Eclipse, Maven and WRO4J

Maven Plugin Working Directory Not Constant

I wrote a Maven Plugin that creates some XML files on the classpath of my project. The Maven Project is fairly complex and has one master project with many sub projects (think services for a larger application).
The plugin takes a directory argument in the pom.xml, which is something relative to the classpath like this:
<docDestination>src/main/webapp/static/</docDestination>
However, when I try to access this folder via new File(docDestination), the resulting directory depends on the project (or sub-project) from which I ran the mvn install command that triggered the plugin.
The plugin is only specified in the pom.xml of one of the sub-projects, but if I run mvn-install from the parent it creates the XML files in the src/main/... folder of the parent application. How do I get the plugin to use the filesystem of the project in which it is declared rather than the filesystem of the parent project?
I should note that if I navigate to the sub-project in Terminal and run mvn install in that directory the files are created in the right place, which explains the title of my post.
Use the ${basedir} variable:
<docDestination>${basedir}/src/main/webapp/static</docDestination>
This should use the basedir currently used by the respective module (regardless of whether this is the top-level or a sub-module).

Dnn Module Packaging Question

I have folders inside a module which I developed and there are many files inside them.
How can I package the folders with files?
Should I archive the folders in a zip file? If so, how can I extract them again?
You have a few options.
Include a resources.zip file, that will be extracted for you upon installation, just be sure to include the resources.zip in your .dnn file list.
If you are using a DNN 5.x manifest, you could keep the folder structure within the module and just use the folder names items in the 5.x manifest.

Resources