Automate Tomcat adding to Eclipse - eclipse

I'm trying to write a script (Perl) that will automate the adding of Tomcat server for a Java project under Eclipse.
The project is checked out via SVN, and I want, once the project is downloaded via SVN, to run a script that will automatically configure the remaining bits of the project. In this context, I need to find how can I edit which Eclipse's configuration files to automate the adding of a Tomcat server. Actually the script will also modify other configuration files, but I'm facing a hard time trying to find which files to edit and how to add Tomcat.
Any insights will be welcome, thanks in advance.

There is a plugin for eclipse called Escripts. You can create xml like scripts to automate actions like doing wizard actions. I tried to check the documentation, but the homepage of the Escripts is giving back http 500 for me (http://escripts.sf.net). I have written a mail to the author, if he answers, I will let you know. The update site looks like working (uncheck the categorize by groups to see the uncategorized plugin): http://escripts.sf.net/updates .
Some examples you can found at http://escripts.svn.sourceforge.net/viewvc/escripts/trunk/net.sf.escripts.tests/src/net/sf/escripts/tests/
What you should enter in the script is a wizard with id org.eclipse.wst.server.ui.new.server. The plugin, that is containing it is org.eclipse.wst.server.ui. Take a look at the plugin.xml in that plugin. Without the documentation, this is what I can remember of.

Have you tried the following files in the Eclipse workspace?
.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.jdt.core.prefs
.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.jdt.launching.prefs
.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.wst.server.core.prefs
.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.jst.server.tomcat.core.prefs
I took the following files and dropped them into a new instance of eclipse and it created the Tomcat server under Server->Runtime Environment.
http://dl.dropbox.com/u/9591144/StackOverflow/org.eclipse.jdt.core.prefs
http://dl.dropbox.com/u/9591144/StackOverflow/org.eclipse.jdt.launching.prefs
http://dl.dropbox.com/u/9591144/StackOverflow/org.eclipse.jst.server.tomcat.core.prefs
http://dl.dropbox.com/u/9591144/StackOverflow/org.eclipse.wst.server.core.prefs

Related

Tomcat and Eclipse vs Intellij

I am working with Intellij but some of my co-workers don't. When I was writing install doc, I realized that Tomcat is not managed the same way on the two IDEs.
Which is a problem considering what happened next when I tried to set up our project on Eclipse.
Basically, on Intellij, you select a Tomcat on your computer and it will literally copy the war into the webapps folder and run the server with everything working fine.
I am not a user of Eclipse so I might have misunderstood something, but I found that when you create a Tomcat server, it will embed the one you gave it to it. Doing that is a bit of an issue when you are working with logback, because usually you set your logs location directly into the Tomcat folder. And in Eclipse you are working out of this folder.
So, I can't run my application because it can't find the location of the logs folder at the fine place.
Is there a way to use Tomcat in Eclipse like Intellij? Or did I just miss something because I am kind of new with Eclipse?
See the FAQ: (1) (2)
I found that when you create a Tomcat server, it will embed the one you gave it to it.
You have to be more specific with your description. How you do things and what do you see. What do you mean by "embed"? What is the actual failure that you are observing with your logging?
There are different ways to do things.
For me by default Eclipse does not embed Tomcat, but runs it as a proper java process. (org.apache.catalina.startup.Bootstrap) You should be able to see it with jconsole and similar tools.
It runs your web application expanded, i.e. without zipping it into a war file. It creates a separate configuration of Tomcat, i.e. runs it with separate CATALINA_HOME and CATALINA_BASE directories (as documented in RUNNING.txt file of Apache Tomcat). The CATALINA_HOME directory stays untouched and CATALINA_BASE directory is ${workspace}/.metadata/.plugins/org.eclipse.wst.server.core/tmp0 etc. A logs directory can be found there.
One known caveat is that java.util.logging is not configured by default (the system properties java.util.logging.manager and others are not set). See "How do I enable the JULI logging" item in the FAQ. -- In the same way you will set any other system properties that you may need.
The default configuration of java.util.logging (as provided by JRE) is to log everything to the console, without creating any files.

Easiest way to deploy OSGi framework from Eclipse?

I am developing a server with Jetty (servlet container). I am successfully running the server within Eclipse with an osgi-framework run configuration. Everything fine.
What is the best way to export this run configuration so that I have a valid config.ini and all plugins (the workspace bundles and the ones from my target platform) and am able to run the osgi-framework without Eclipse IDE running.
I tried to make a product to get the config.ini and all the bundles but I cannot run the framework with java -jar org.eclipse.osgi_3.6.2.R36x_v20110210.jar.
It is not finding the bundles in the plugin folder, because obviously the names do not match exactly (e.g.: com.mine.at-3.3.-3234234.jar instead of com.mine.at.jar)
There are about 150 bundles and I do not want to edit the config.ini manually.
What did I miss?
What worked pretty well for me was to make a new product, based on the (working) run configuration, and export the product. That project should then be 'runnable', or at least pretty close.
Did you try that?
Hope it helps, Frank

Liferay Hooks plugins folder

I am using Liferay 6 version.
I am trying to Learn Liferay, due to its importance.
I am into the Liferay Hooks concept, for this I am following this site:
http://kamalkantrajput.blogspot.com/2009/05/using-hooks-in-liferay-for-customizing.html
In this the author mentions about this below:
Go to plugins/hooks create a folder with any name. eg asset-publisher-hook
Please tell me where can i find the plugins folder?
Because inside the Liferay Tomcat, I found 6 folders with the name plugins and no folder hooks under this .
Please guide me.
You might also want to read the documentation in the Liferay Wiki:
http://www.liferay.com/community/wiki/-/wiki/Main/Portal+Hook+Plugins
In a Nutshell: once you have created the hook plugin (as described by adarshr) you can simply deploy the portlet like any other portlet.
If you want to remove the hook, make sure to undeploy it while Tomcat is running. Otherwise Liferay will not be informed about it and the original JSPs won't be restored.
Un-deploying can be done by simply deleting the portlet's directory in the Tomcat webapps folder.
You need to install the Plugins SDK which can be downloaded from http://www.liferay.com/downloads. Select "Plugins SDK" in the dropdown and click download.
Once you extract it, open a command prompt in the hooks folder. Then you execute the command create asset-publisher-hook "Asset Publisher Hook" and it will create the basic hooks project for you.

Issue making a Liferay Hook with Eclipse Liferay IDE - getting only empty project

I am using Eclipse Liferay IDE for making a hook to a Liferay native portlet. I mean a porlet that comes with default installation, eg. blogs, content management or similar.
I have done the steps like following:
Select new Liferay Project
Enter project name MyHook
Made configurations (found an SDK directory and Liferay Server instance for Runtime)
Selected Plugin type to Hook
My only option after that was Finish and I ended up having a project with certain structure without any class or properties file inside.
My problem is that I could only get an empty project and don't know how to make the modifications to the files of Liferay because no Liferay originated package names can be found if I make a new class file and try to start typing com.Liferay. or org.Liferay. Because this is a Liferay Hook project, I suppose some Liferay originating tips should normally pop up for my selection, but I didn't see any.
What I am making wrong? What I am missing? Should I know the filenames by myself or is there a trick somewhere to tell the IDE to give me some help?
I use Liferay 6.0 and my IDE version is 6.0.5. At least in my eyes they should match together.
In the IDE you first create a "Liferay Hook Project". This is indeed an empty project. Then you create a Hook, select the Hook project to create it in. You can do the second step manually, but there's a wizard helping you to do this. This might be what you've been missing
I made the same steps again and it worked! Somehow at first time I managed to do a Java project although the project should be interpreted as a Liferay project.
Maybe the IDE is not 100% working always. Whoever knows.

How can I setup ANT with Subversion and ColdFusion Builder (eclipse) to check out a local build to work on?

I am not sure if there's an answer for this already -- couldn't find one for this (hopefully common) setup:
I recently converted one of my ColdFusion projects to deploy via ANT.
I have a local ant script that instructs a remote server to check out the code, and run the application's specific build file, remotely on the server.
I have a few endpoints:
Live - production (on the production server)
Staging - on the production server, different datasource, etc.
dev - on the local box.
What I have run into it seems is a simple and common problem. I now need ANT to create any build, even locally. Fine, created a local endpoint and it configures for my box.
Issue? How do I get it to show up as a project (automatically if possible) in Eclipse/ColdFusion builder. What I envision is instead of checking out a branch via the subversion plugin in CFBuilder/Eclipse, I now use ANT to do that for me.
Since I use ColdFusion Builder (Eclipse + Adobe's plugin), I have all of eclipse's tools and plugins available to solve the problem of : how can I best call ANT from within Eclipse/ColdFusion Builder, to setup the local build as a project that I can develop and work on?
I think when I check the code back in from the local box, I'd have to be sure not to check in any files with local config paths, etc.
I hope this is a detailed and clear enough explanation, if not, please ask.
Thanks in advance!
You won't be able to have it "automatically" show up in CFBuilder, but you can make it pretty easy.
Eclipse requires the ".project" file, which is a simple xml file that by default generally just contains the project name.
Once you check out your project from SVN, Do file -- new -- ColdFusion project and point it to the directory where you've checked out your code. This will create the .project in there. From there, you can commit that file to SVN.
Subsequent developers who check out the project from SVN can then do File -- Import -- Existing Project into workspace, and point it to their checked out location. Since it'll have the .project file in there (from when you committed it), that project will show up when they search for projects in that import wizard.
Now, that's how you'd do it if you already used ANT to check out the code. However, if you wanted a potentially even easier way, then you can just install either the Subversive or Subclipse plugin into CFBuilder, and then do
file -- new -- checkout project from svn
point to your svn url
select the directory you want to check out
choose a location where you want the code to live
click through to completion