How to add library path in bnd file in liferay7? - liferay-7

I have created a module project using mvc-portlet.For my project, I need to import a few jar files.
For this purpose, I have created a lib file in the project module and have added its path to the build.gradle .Now while building the project is working, but at the time of deployment it is not starting(i.e.: the portlet stays in installed phase).
I understand it is because I have not added the lib folder path in my and files. But I am not sure as to how should I proceed regarding it.
I am using eclipse ide and Liferay 7 along with tomcat for development

First of all, if you want to know why your module is not working, I suggest you tu use the diag command on the Gogo Shell.
Now, to manage the problem with the libraries, you have to include the jar files (extracted) inside your module, this is create a fat jar. Basically add a task to your build gradle like this:
task customFatJar(type: Jar) {
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
It could be great if you create a fat jar with only the libraries, and export it's packages on the bnd, and then you consume them from a different module.

Related

deploy jar Java Desktop Application in jdeveloper12c

I have always developed my java NetBeans projects. When I finish my project, and automatically build "dist" folder where the main jar and a "lib" folder containing all the external jar was created. This is done automatically with the NetBeans IDE
Now I'm trying to do a project with jdeveloper 12c Java Desktop Application and try to deploy my project but I have problems with java.lang.NoClassDefFoundError. I meet several questions:
Can you add the same structure as I said before? That is, a file jar and inside a folder "lib" place the jars using How to do it?
I've seen examples that by New File Group adds refencias, but it really adds to the main jar file (as I see in the size of the file) but not saved in a separate folder.
I do not know if you can help me do this in jdeveloper 12c: Generate a jar file and folder lib with references.
Thank you for your help.
Go into the deployment profile for your project and add all the libraries and files that you need to be included to the JAR you are generating.

Keep external JARs outside the project JAR while creating product in Eclipse

My eclipse project structure is as given below
->MyProject
-->JRE System Lib
-->plugin dependencies
-->src
-->extJars (contains some external JARs)
-->icons(contains icons files)
-->META-INF
-->build.properties
-->plugin.xml
-->Myproject.product
When I export MyProject as a product using Eclipse MyProject.product, complete files in MyProject including ExtJars and icons get bundled as a single JAR file.
MyProject/plugins/MyProject_1.0.0.0.jar
I want extJars and icons to be kept outside that single JAR file.
Kindly help me in achieving this.
Thank You
If you use 'features' to build your product you can use the 'unpack the plug-in archive after the installation' option in the 'feature.xml' to have the plug-in expanded when it is installed.

scala generating jar file from scala-io to include in eclipse

I am trying to use the library scala-io in my Eclipse environment, does anyone know how do I generate a jar file, or which folder to include in my eclipse so that I can have access to the scala-io library from my project ?
EDIT:
Q: How to incorporate an external library into scala IDE?
A: Two possibilities:
Leverage SBT to build your project; that is generating jar files and maintaining dependency
Including the generted jar files directory in the IDE, project -> Properties -> Java build paths.
hth.
EDIT #2:
I found this great plugin to generate all of your dependencies in one jar file sbt-assembly
http://jesseeichar.github.io/scala-io-doc/0.4.2/index.html#!/getting-started
shows how to start with sbt or maven or with prebuild jars provided by links.
You should try to get familiar with a build system like sbt. Its cumbersome to always manually add dependencies to eclipse, especially if you have dependency chains: scala-io needs scala-io-core and arm and file etc...

Eclipse build path: library with native library folder

I created an Eclipse project and I need to use the Super CSV library with Dozer. I downloaded the Super CSV and created a new folder "super-csv" in /usr/lib.
Now I have: /usr/lib/super-csv/super-csv that contains the super csv jar (+ javadoc and source),
/usr/lib/super-csv/super-csv-dozer that contains the super csv dozer jar, javadoc and source plus a "lib" folder.
Inside /usr/lib/super-csv/super-csv-dozer/lib there are many .jar files that are needed for super-csv-dozer to work, so I added it as native library for super-csv-dozer entry in library tab of java build path in Eclipse.
When I try to compile the project, I receive a java.lang.ClassNotFoundException pointing a class that is contained in one of the jar files in the lib folder.
Everything works only if I manually add every jar in lib folder as an external jar.
Can someone explain me where I am doing wrong?
I'd recommend using Maven - it's a widely used tool for Java builds. To start using Super CSV, it would be as simple as adding the 2 dependencies (listed on the Super CSV website), and your Eclipse project would be ready to go.
There's a bit of a learning curve though, so if you want to just add the jars to Eclipse's build path manually, I'd recommend creating a lib directory at the root of your project and putting all of the jars there.
my-project
|-src
| |- (your source in here)
|
|-lib
|-commons-beanutils-1.8.3.jar
|-commons-lang-2.5.jar
|-commons-logging-1.1.1.jar
|-dozer-5.3.2.jar
|-slf4j-api-1.7.1.jar
|-super-csv-2.0.1.jar
|-super-csv-dozer-2.0.1.jar
You can then add them to the build path (here's a good guide).
Just a note: if you're not using the Dozer extension, then you'll only need super-csv-2.0.1.jar on the build path.

How can I use netbeans to export each package into separate jars?

Right now, netbeans exports all the packages in a single project into a single jar, I would like it to export a separate jar for each package, how would I go about doing that?
Would also like to know how can I include all my dependent libraries into the generated jar