How do you export Servers in Eclipse/SpringToolSuite? - eclipse

Is there a way to export both Server launch configurations and the actual Servers (e.g. as seen in the 'Servers' view)?
I have four Tomcat Servers configured in Eclipse/STS, corresponding to four Server launch configurations. I want to export both of these sets so I can import into another workspace.
The Eclipse Export wizard has an 'Export Launch Configurations' but there is no apparent option to export the actual Servers and their associated settings (server name, ports, modules, etc).
Given the maturity of Eclipse assume it is there and I'm just missing it.

I am not sure if there is a direct export present. But there seems to be another way of doing it. You can go the properties of the server you want you export. You will find 'Configuration path' over there. You can click on browser and copy the desired configurations.
All the configurations for that particular server are stored in that location. Sometimes this shows up in your package explorer as well if config is present inside workspace.
You may right click on the servers folder(inside pakage explorer) and then select show in>System explorer.
You can copy the server config and replace them on the other machine's workspace.
Similarly if you really want to copy servers, in server properties if you scroll down, you'll find 'server path' and 'deploy path'. You can navigate to that path and replace them on your new machine.

Related

Eclipse Project - need to have a copy locally and a copy on a remote server

I develop in PHP using Zend Studio - operating as an Eclipse plugin - has a really nice feature called "Automatic Upload" that can be configured on a per Project basis. This feature allows one to define a remote connection to a server for a Project, and also specify whether file copy to the remote server is "manual" or "on save".
We use the "on save" option extensively, as it allows us to edit a file via Eclipse, save it, and immediately see the file in play on our remote web server.
Specifically the functionality we are after is as follows:
Create or edit a local file in Eclipse
On Save of the local copy, automatically creates / updates the remote copy
On Delete of the local copy, deletes the remote copy
(cut/copy & paste behave in a conceptually equivalent way)
and
Manual batch "upload to remote" and "download from remote" menu options that allows full upload / download of all files as well as manual cherry picking of files to upload or download.
This feature is really nice and has very broad application so I expected it to be standard Eclipse functionality, however I have installed Eclipse Oxygen, and can't find it. I have subsequently done rather a lot of searching, and although there are some manual options that have appeared, the closest I can find to an automated copy equivalent is the Parallel Development Tools plug-in which provides a "Synchronized Project" option.
Synchronized Projects require git running on both local and remote and a git folder structure inserted into the Project. Additionally, hidden files are injected into every Project sub-folder.
The above renders Synchronized Projects too "heavy" and potentially problematic to manage for us.
So I am fairly desperately looking for an Eclipse Oxygen (or Neon is fine) plug-in that provides the functionality outlined above.
Your input is greatly welcomed. Thanks in advance!
While not exactly remote sync, a little lateral thinking has given me exactly what we need. What I did is as follows:
Remote (linux)
Install Samba
Use Samba to present the desired folder as a Windows share
Local (PC)
Windows File explorer
mapped the remote windows share to a local mapped drive
Eclipse
downloaded and installed the File Sync plug-in from Eclipse market place
right-clicked on my Project and selected Properties => File synchronisation, and configured the desired folders (setting the "remote" as the mapped drive)
and one final item (because we are mapping from a Windows local to a Linux remote) : Window => Preferences => General => Workspace Set "New text file line delimiter" to "Other => Unix"
And hey presto, everything is working 100%.
You can do this by a project builder Ant buildfile. Alternative, there are others build system that are implements the Eclipse project builder (to be executed on save), but which must be installed separately. You can also implement your own incremental project builder in Java.

Tomcat - how to create multiple servers with separate configuration

I'd like to run a separate Tomcat Server in my Eclipse/STS environment to mirror the production environment. I managed to create a new Tomcat server with copy/paste, but the "Server" section under navigator still shows only a single Tomcat server. Any idea how to fix this?
1st. Copy-paste the configuration located in Servers project, and rename it to the_new_server
2nd. Copy-paste the server in "Servers" view
3rd. Double click the newly created server, fill the fields as shown, use the Browse button for choosing the configuration path, otherwise won't work, and save
4th. Right click the new server and select Properties. Click "Switch location".
A dialog will appear asking you "Do you want to rename...", but this is not important, if you click "yes", the config folder will be automatically renamed to the_new_server-config.
5th. That's it.

common workspace setup in eclipse

I want to create several workspaces which point to different branches of a codebase.
The problem I am facing is every time I need to create a new workspace I have to do the same configuration for each workspace.
Example:
Setting up tomcat configuration and it's related java options such as library and java agent settings.
A system variable that points to specific folder containg my jar files.
Another system variable
Questions:
is it possible to have these setups done once so that all subsequent workspaces do not need to be configured?
is it possible to export these preferences and import later into any workspace either on my machine or other machine?
System information:
Windows 7, Eclipse 3.5, Sysdeo tomcat plugin, Tomcat 6
While eclipse does have an Export preferences option, it does not export everything and specifically it is not comprehensive enough for workspace duplication.
In the past I have had a lot of success just cloning the physical workspace folder itself.
For example, let's say you have setup the workspace with everything that you want in it. To duplicate it, find out the path of the current workspace folder by going to File -> Switch workspace -> Other. The path shown here in the dialogue that pops up is the current workspace path ( don't press ok yet)
Create a copy of this folder. Now to use this copy, just use it in the above dialogue, i.e., go to File -> Switch workspace -> Other and put in the path of the copy. Press OK and Eclipse shall restart with the new workspace. Now the only thing you will have to do is point the code to a different branch. Rest all the settings should be present already.
This works specially well on the same machine. If you copy this workspace folder it should still work but your mileage may vary.

Share / Export eclipse working sets

I have created a couple of java working sets for a project in my workspace and want to share them with other people (using different workspaces). Is there a way to export them?
You can try and export (as in "copy to another people workspace metadata directory"):
</path/to/.metadata>\.plugins\org.eclipse.ui.workbench\workingsets.xml
This is the file referencing your working sets.
z0r adds in the comments:
my team mate replaced his workingsets.xml with my version of the file, and it worked well.
However, you must exit Eclipse before replacing the file, because Eclipse will overwrite it with the old version when it exits.
I think you only need to do this once.
download the AnyEdit addon:
Description | Download page
and then use the following work through:
Via the menu bar: File > “Export…”
Select “General” / “Working Sets”
Click “Next >”
Select the working set(s) you want to export and where you want to export the file.
Click “Finish” to perform the export.
In Eclipse Indigo the working sets export has moved to Export -> Team Project Set and there is a check box top left to export working sets.
Although, File → Export → Team → Team Project Set is the correct way to export working sets, you could write an Eclipse External Tool.
External Tools
Open a new dialog by navigating:
Run → External Tools → External Tools Configurations…
Select Program and click the New button to create a new configuration.
Note: You will only need to use the "Main" tab.
Give the tool a title e.g. "Export Working Sets"
Windows
Location: ${env_var:SystemRoot}\System32\cmd.exe
Working Directory: ${env_var:USERPROFILE}\Documents
Arguments:
/c copy /y ${workspace_loc}\.metadata\.plugins\org.eclipse.ui.workbench\workingsets.xml workingsets-${current_date}.xml
Linux
Location: /bin/cp
Working Directory: ${env_var:HOME}/Documents
Arguments:
${workspace_loc}/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml workingsets-${current_date}.xml

Server configuration is missing in Eclipse

Im using Eclipse Galileo, and have configured it for Apache Tomcat . I have added Apache Tomcat 6.0 to Windows->Server->Runtime Environments, with the following settings:
Tomcat Installation Directory - C:\apache-tomcat-6.0.24\apache-tomcat-6.0.24
JRE - Workbench Default JRE (This points to C:\Program Files\Java\jre6)
Now, I create a Dynamic Web Project, and add a JSP file to it. But, when I run the project I get the following error:
The Tomcat server configuration at \Servers\Tomcat v6.0 Server at localhost-config is missing. Check the server for errors.
Any way to fix this?
Probably, you have some problems with your server's configuration.
Follow these steps to remove and create a new one, it might help you.
In Eclipse
1. Window -> Show view -> Servers (If you cannot see it, you might need to choose Others -> Server)
2. From Server view -> Delete the server which has problems.
3. Right click -> New -> Server : to create a new one
In my case, after new server was created, I get rid of this "localhost-config is missing"
I faced the same problem once. THe reason for this is that even though the server is available, the config files are missing. You can see the server at Windows -> Show view -> Servers. Their configuration files can be seen at Project Explorer -> Servers. For some reason this second mentioned config files were missing.
I simply deleted the existing server and created a new one with this the config files were also created and the problem was solved!
Similar solution is given at here by Emertana EM
java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
In Eclipse Neo
1. Window -> Show view -> Servers
2. Right click on server -> choose Properties
3. From General Tab -> Switch Location
As Yoni already mentioned, you probably deleted the project named "Servers" from your Project Explorer. If config files for the server still present on a file system, the quickest way to restore it will be Right Click in Project Explorer->Import->General->Existing Projects into Workspace, then select the root dir where Servers dir located, set checkbox near "Servers" and finally click Finish. If everything works as expected, you should see the 'Servers' project added to the Project Explorer view and your old config files will be there. Finally, save the tomcat configuration which you had open. You can startup your Tomcat server without errors now.
From project explorer ,just make sure that Servers is not closed
You need to define the server instance in the Servers view.
In the box at the right bottom, press the Servers tab and add the server there. You by the way don't necessarily need to add it through global IDE preferences. It will be automagically added when you define it in Servers view. The preference you've modified just defines default locations, not the whole server instance itself. If you for instance upgrade/move the server, you can change the physical location there.
Once defining the server in the Servers view, you need to add the newly created server instance to the project through its Server and Targeted runtime preference.
If you're not too attached to your current workspace you can create a new workspace, follow BalusC's steps for server creation, and recreate your project in the new workspace.
I got the same error after installing Eclipse Java EE IDE for Web Developers(Juno) but using the workspace of a much older Eclipse installation. When I created a new workspace I was able to get my Tomcat server running without this error.
Did you, by any chance, deleted stuff from your workspace, or moved it around?
When you create a server for the first time, either globally or through the project's "run on server" settings, Eclipse creates a project in the Servers view, as BalusC pointed out. Eclipse stores this server inside your workspace, in a project called Servers. The project needs to be open for tomcat to run.
(If you want, you can store the server settings elsewher. You can right click and open the server instance from the Servers view and configure various parameters and locations)
This happens when Eclipse shuts down incorrectly - delete the server and then re-create it again.
Remove the server from IDE and install again to it.
In my case, the server list was empty for Apache in "Run Configurations" when I opened
Run > Run Configurations
I fixed this by creating a server in the Servers Panel as in other answers:
Window -> Show view -> Servers
Right click -> New -> Server : to create a new one
this worked for me
In the Server's tab in Eclipse, Stop the Tomcat server
Right-click the server and select "Clean..."
Right-click the server again and select "Clean Tomcat Work Directory..."
In the Eclipse, select the top-level menu option, Project > Clean ...
Be sure your project is selected and click Ok
Restart Eclipse
4th Step is most important.
Go to Servers remove the existing server by clicking delete.
Click the blue link to launch the server.
Set a new runtime environment.
Close the Eclipse and launch it again.
Boom it works!