How to set classpath in spring tool suite - sts-springsourcetoolsuite

I have added a grails project to workspace and i want to set the classpath.how to do this.
I am not able to find an option to set the classpath in project->properties.

If you are creating a grails project, you should be setting your classpath through grails, rather than through STS. I assume that you already have the Grails Tooling of STS installed.
The way that you alter a grails project's classpath depends on what you are trying to do. Please explain exactly what you are trying to do and I can perhaps be more specific.

Related

What is symfony in the vendor folder?

When I create an app using composer, or install another app created using composer, there is a vendor/symfony folder included.
For example, I installed Laravel using composer. The folder vendor/symfony is present. I am not specifically referencing this in my Laravel app at all.
What is this folder, and it needed? Does the app use it, or composer use it? So if I am using an app created using Composer and dont use composer myself, can it safely be deleted and the app still run? Or could the app be using it?
Thanks
Answer is quite simple: Laravel uses Symfony components.
Check this article: http://www.sitepoint.com/build-php-framework-symfony-components/
Improved Routing Engine
Laravel 4.1 features a totally re-written routing layer. The API is
the same; however, registering routes is a full 100% faster compared
to 4.0. The entire engine has been greatly simplified, and the
dependency on Symfony Routing has been minimized to the compiling of
route expressions.
http://laravel.com/docs/master/releases
The "vendor" folder is a standard in every application / framework that uses composer to manage dependencies. In the "vendor" folder you will find all dependencies (read: libraries) that your applicatication requires.
But you will also find all libraries that your libraries require. In order to minimize code duplication, and thanks to the composer system, most open source projects now reuse parts from other open source projects.
BTW, this is great.
Symfony components are excellent and well documented, so they are currently used by many other frameworks and applications.
Inside the "vendor" you may find other libraries that you did not specifically require yourself, but as long as your correctly use composer, that's not something you should worry about.

Creating a fat jar for Dropwizard application

I am trying to create a fat jar for a multi module java project following the dropwizard documentation that makes use of the maven shade plugin.
https://dropwizard.github.io/dropwizard/getting-started.html#building-fat-jars
In order to do this I created another aggregator project which is just another pom.xml and configured the plugin in this pom.xml
Is there a way I can add my classpath in this configuration? What am I missing?
For all those interested. I fixed the issue by forcing Guava version 12 that the application gets from dropwizard.

Need Pointers | Using JDBCTemplate | CQ 5.5

I need some pointers/suggestions on following scenario.
Scenario:
We are trying to use JDBCTemplate in CQ 5.5 for querying database (Oracle 11g). As first step we have integrated CQ with Spring Framework. Now for JDBCTemplate to work it requires JDBC driver that needs to be loaded separately into CQ as it is not available with Spring jars. The jar that is required is available here http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html and jar in my case is “ojdbc6.jar” that contains OracleDriver class (JavaDoc: *http://docs.oracle.com/cd/E11882_01/appdev.112/e13995/oracle/jdbc/OracleDriver.html*) required to register the driver to create connection with Database.
Problems/Suggestions required on following points:
As oracle 11g is commercial product so there is no repository available online for it (for pom dependencies), we need to create a separate local repository for it. (Need pointers; is there any other way to do it?)
Jar mentioned above is not OSGi. So how to approach in that case? (I have created OSGi bundle by following directions mentioned here http://cq-ops.tumblr.com/post/21893960212/how-to-turn-a-jdbc-driver-jar-into-an-osgi-bundle-jar)
In this process of converting this jar to OSGi Bundle I have to remove versions mentioned with Imported Packages in MANIFEST.MF file. (As I understand that CQ by-default picks the latest version that is available for any class, there may be problem when a new version of any class is available that is not compatible with current version. Need pointers; should this be looked into priority? Has anybody faced any issue due to this in any project)
Current Status:
By converting ojdbc5.jar to OSGi bundle; I was able to use JDBCTemplate. But looking for some pointers to check is there any other approach someone has followed in other project to achieve scenario mentioned above?
The oracle driver is not published to any public maven repo. So indeed you will have to put the jar into your own maven repo
In Apache Karaf there is a nice feature where you write wrap: in front of a bundle url and it automatically creates a bundle on the fly using the bnd tool.
If CQ does not have such a feature then you will have to create the bundle on your own. In this case the maven bundle plugin can help you. You can depend on the oracle jar using a maven dependency. Then you can define exports for the packages of the oracle jar. Bnd should then automatically inline the classes in you bundle jar. Another option is the maven shade plugin. You can take a look at the source of the servicemix bundles. There you find poms to bundle a lot of plain jars.
Not sure what exactly you mean. As far as I know the oracle driver does not have any external dependencies.
I have written a DB tutorial for Apache Karaf that explains how to deal with the oracle driver and how to create data sources without depending on the concrete driver.
The solutions in the tutorial can not be used 1:1 in CQ but it will surely give you some pointers.

Jar to include to use javax.annotation.*

I'm a bit confused. I need to compile a project in jDeveloper 11.1.1.6.0. The server side of the project is deployed on the Glassfish server. On the machine of the project's creator everything compiles without any problems.
Using project properties -> Libraries and Classpath I added the libraries such as gf-client.jar, security etc. from $glassfish_home/glassfish/modules and some others (e.g. hibernate3.jar from hibernate dir).
When I try to compile the project I receive the following errors:
package javax.annotation.security does not exist
and
package javax.persistence does not exist.
I suppose that I miss some jars to include. I tried to find which jars (from Glassfish or from JDK) contain javax.annotation.* and javax.persistence.* but I couldn't.
If you have any ideas I would be thankful!
I was having the same problem and was able to solve it by adding a couple of dependencies to the Maven pom.xml file. See this answer for more details.
So I found the source of the problem. The application consists of 2 projects, of which only one (mentioned in the question) uses EJB. I'm not sure if it is the way it should be, but I tried adding ejb-files to another project. And after clean all and rebuild all it compiled like a charm for me. I hope this will help somebody in the future.

Received a main jar file with other jar files that need to be in the classpath. Whats the best way to include this main jar in my maven project?

So i received a java api from a client and the main code is in main.jar. But the instructions he gave me require me to add these other jars (a.jar, b.jar, etc..) into the classpath whenever I want to use main.jar. These other supporting jars are things like Xerces, jakarta-oro, and a few other publicly available libraries. The problem is i don't know what versions they are, so i'm not sure if there would be issues if i just update the pom.xml file in my app to depend on main.jar and also have dependencies to these other jars as well with the latest versions of them.
Whats the best strategy for using main.jar in my maven application? I'm planning on adding main.jar to our internal maven repository, but what should i do about the xerces, jakarta-oro, and other jars when i dont know what versions they are?
Thanks
If you are lucky the file /META-INF/MANIFEST.MF inside a.jar, b.jar etc. contains an entry "Implementation-Version" or some other useful information which tell you what version they are. If not, you can download the latest release(s) from the project web site and check if they have the same file size as your bundled dependencies.
You may also come to the idea to bundle the dependencies with the main.jar in one big jar, but this may become funny, when you have the dependencies twice in your classpath at some point in the future...
What about just asking the client what version numbers this dependencies have?
If you don't have any information about these third-party libraries, just add them to src/resources/META-INF/lib and commit to SVN. That's the best way, if we're talking about black box approach.

Resources