SpringSource integration with eclipse - java

I am attempting to integrate the sonarqube plug-in with eclipse. However, I want to do this on another machine that does not have network access. I have copied the .jar files into the Spring plugins folder. This does not properly install it.
I was wondering how I can go about this installation process?
Thanks

Doing a copy of plugins JAR is not a good idea. You will miss some items (especially features, config, ...).
You could download the update site content from http://downloads.sonarsource.com/eclipse/eclipse/ and then copy it to your offline computer and configure a local update site (file://xxxx).

Related

Auto-install Eclipse Lombok plugin - Java

We just started using Lombok plugin for Java.
Developers in our company use Eclipse for workspace and we have some clients who get access to part of our source code.
If we use Lombok library, it doesn't get detected in Eclipse until the plugin is manually installed.
It's hard to send a communication to multiple clients and have them mandate the plugin installation.
Is there a way to automatically install a plugin from the project itself, may be with an yes/no question to let the users accept it, that way we don't get accused of sneaking stuff in :)
It is NOT possible to install an Eclipse plugin from the project itself.
It is clearly stated in the Lombok documentation that manual installation is necessary as Lombok is a preprocessor. Lombok needs to be installed to the Eclipse install folder (next to eclipse.ini). https://projectlombok.org/setup/eclipse
And I suppose it would be a security leak (both in Eclipse and your Customer's environment) if you are able to install something into the 'Program Files' folder from your projects without user interaction. However manually copying is feasible and could be a workaround if you are very keen to do so.
Workaround: You might provide an ANT/GRADLE script that will distribute you local copy of the lombok.jar into Eclipse's program folder. And also create a launcher configuration. So you can refer to this launcher step to be executed. Please note that you need to restart eclipse just after lombok installed. But in fact this is what lombok.jar does when running as described in the install guide.
The standard lombok installation is being done manually.
Therefore, I've created an automatic installer.
It's available here: https://github.com/zorik9/lombok-automatic-installer
Right now it supports only eclipse IDE in windows machine.
The idea is to configure once the variables: lombok_version, eclipse_home and workspace_dir (not mandatory)
And based on this configuration, run the installation script on each machine.
For more details, please read the readme.md file.

Use Intellij and netbeans at the same time in the same workspace

I was provided with a Ubuntu virtual box that has netbeans installed whereas locally I have Intellij. My Java workspace is shared between guest and host, therefore I was wondering if there will be any kind of conflict by running Intellij and Netbeans at the same time in such conditions.
Thank you for your help.
I am not sure how the guest-and-host-OSes condition would play into this but I am pretty sure otherwise that the workspace can be shared by both of them especially when they are not working on the same project. Even if they are, it'd be you who'd be getting confused as files would get updated on both IDEs as the other one makes any changes.
There should not be any conflict as long as you have read/write permissions on both the OSs.
However, to track the changes to code in a better way, use a version control system like subversion.
Also, do not copy the resources to your workspaces. Instead check out the code directly to your workspace.
This don't cause conflicts because each IDE adds a set of configuration files per project, for example: netbeans generates the nbproject folder, where is the project configuration for that IDE, while intellij generates a projectName.iml file and the .idea folder where is the configuration for the project.
If you use a version control tool as git, svn, mercurial, is recommended that you synchronize your project in each environment (guest and host) with your repository and do not share the workspace between them.

IntelliJ Maven WAR with Chrome Developer Workspaces

I'm trying to use IntelliJ to do my web development.
With Eclipse I didn't use a Maven build and simply changed between Chrome Dev Tools and Eclipse when I would need to switch between frontend and backend changes and was able to map the Chrome workspace to a static webapp folder that wasn't part of a Maven build.
Now I've switched to IntelliJ (mainly for its Java tools) but now I'm unable to use it alongside Chrome Dev Tools.
I have the 'Update Resources' on frame deactivation set, which works if I edit a local javascript file and then move away or save the file, but if I try to use Chrome Dev Tools Workspaces to save it, obviously IntelliJ doesn't pick up that the file has been externally updated and therefore doesn't update the file in the exploded WAR.
Is there some way I can do these together? I like a lot of things about IntelliJ for Java development, but I find that Chrome is far and away the best IDE for Javascript/CSS/HTML changes and would like to use it alongside IntelliJ.
I found it is much easier to simply compile the web app in place into WEB-INF rather than using maven. You can still use maven for dependencies but just ignore the maven lifecycle for local development. It's not necessary for local development and adds time to the compilation/deploy process.
Let me know if this is a bad idea. It has worked quite well for me.

how to build project after code changes without mvn clean install?

I have a project in eclipse, a java app with appengine sdk and maven as my builder.
The .class files are not refreshed until i launch clean install, so every change i do in code i have to run:
mvn clean install
mvn eclipse:clean
mvn eclipse:eclipse
and then try to launch my app.
Help me please it's really annoying. Thanks
I know this is a very old post but I recently came across this issue while working with STS and Websphere application server. Hope this helps anyone to come across this ancient relic of a post.
Have a look at the "FileSync" plugin in the Eclipse marketplace. It allows to sync your workspace files with external directories (think your application server). After you install "FileSync" you can configure it to "copy/paste" your workspace files directly to your application server's exploded .war directory. It might take a little playing around with to get your files copied in a j2ee compliant format but it worked like a charm for me. Once its configured you basically just update files, save them, and your application is ready to go!
You are probably looking for a hot deployment feature. When working wit ha webapp, in most cases it is not enough just to compile a java class - usually you have to create a war package, and nearly always you have to redeploy the new code to the app server.
mvn package should be enough to create the war. You don't need to run mvn clean as long as you don't remove or rename any file. That would make things faster.
To achieve hot deployment (i.e. to get the new code instantaneously on the web-engine dev server) you need to do do some extra work, however. Make sure you use the Google Plugin for Eclipse - you can use it along with maven. The plugin at least should take care of static files hot deployment. Running the application in debug mode with Eclipse helps a bit as well as it is capable of replacing the methods' bodies on the fly.
Find further information answers to this question.
It's unclear from the question exactly what is happening and why. To figure this out, we would need to see the pom.xml and the "tree" command output showing the relevant folders and files. Then we could compare that to what the relevant maven plugin should be doing, and work from there.
As it stands, this is a quite old question in which it's unclear exactly what's happening, and OP has disappeared a long time ago. If this issue occurred today, the best thing to do would be to post to the App Engine Public Issue Tracker, although this could be inappropriate if the issue weren't in the App Engine SDK (or related maven plugins) but came from a third-party maven plugin not behaving properly (maven-compiler-plugin, for example). However, until a more in-depth analysis were performed, it would be difficult to know in advance.
Getting hot-reload of your App Engine application working is easy using only the Eclipse m2e plugin actually, and doesn't require the GPE plugin or any other special connectors:
1) Create your App Engine app as a Maven project in Eclipse as you would normally, using one of the provided Google archetypes or another custom archetype.
2) Configure your project, and do an initial build with mvn clean install in the root of the project to create the initial target/<artifact>-<version> WAR directory.
3) Start the development server with mvn appengine:devserver in the project root and ensure you can view your locally served app in a browser. Leave the development server running.
4) In Eclipse, make sure that Project -> Build automatically is checked.
Now, whenever you save a .java file Eclipse will automatically build the corresponding .class file under target/<artifact>-<version>/WEB-INF/classes. In a Maven project, this directory is set as the output directory for classes in your .classpath. The development server will detect the file change and do a hot-reload of your application so that the changes will appear immediately when you refresh your app in the browser.

Deploy java (command line) app using Netbeans / ant

I've finally managed to create a Netbeans project out of an old standalone (not Web-) Java application which consisted only out of single .java sources. Now I have basically two questions regarding Netbeans Subversion interaction and application deployment:
Do you check in all the Netbeans project files into the repository, normally?
If I build the project using Netbeans (or ant) I get a .jar file and some additional jar libraries. In order for the app to run properly on the server, some additional config files and directories (log/ for example) are needed. The application itself is a J2SE application (no frameworks) which runs from the command line on a Linux platform. How would you deploy and install such an application? It would also be nice if I could see what version of app is currently installed (maybe by appending the version number to the installed app path).
Thanks for any tips.
No, not usually. Anything specific to NetBeans (or Eclipse, IntteliJ, etc), I don't check in; try to make it build from the command line with your ant script and produce exactly what you want. The build.xml is something that can be used for other IDEs, or in use with Anthill or CruiseControl for automated builds/continuous integration, so that should be checked in. Check in what is needed to produce/create your artifacts.
You don't specify what type of server, or what exact type of application. Some apps are deployed via JNLP/WebStart to be downloaded by multiple users, and have different rules than something deployed standalone for one user on a server to run with no GUI as a monitoring application. I cannot help you more with that unless you can give some more details about your application, the server environment, etc.
Regarding the config files, how do you access those? Are they static and never going to change (something you can load using a ResourceBundle)? ? You can add them to the jar file to look them up in the ResourceBundle, but it all depends on what you are doing there. If they have to be outside the jar file for modification without recompiling, have them copied with an installer script.
As for directories, must they already exist? Or does the application check for their existence, and create them if necessary? If the app can create them if absent, you have no need to create them. If they need to be there, you could make it part of the install script to create those folders before the jar files are installed.
Version number could be as simple as adding an about box somewhere in the app, and looking up the version string in a config/properties file. It has to be maintained, but at least you would be able to access something that would let you know you have deployed build 9876.5.4.321 (or whatever version numbering scheme you use).
Ideally, you should not tie down your application sources and config to a particular IDE.
Questionwise,
I suggest you do not. Keep you repository structure independent of the IDE
You might have to change your application so that it's structure is very generic and can be edited in any IDE.
Is this a web app? A standalone Java app? If you clarify these, it would be easier to answer your query.
We don't check in the /build or the /dist directories.
We tend to use this structure for our Netbeans projects in SVN:
/project1/
/trunk
/tags/
/1.0
/1.1
/binaries/
/1.0
/1.1
When a change is need we check out the netbeans project from trunk/ and make changes to it and check it back in. Once a release of the project is needed we do an SVN copy of the netbeans project files to the next tag version. We also take a copy of the deployable (JAR or WAR) and place it in the version directory under binaries along with any dependencies and config files.
By doing this we have a clean, versioned deployable that is separate from the source. Are deployables are version in the name - project1-1.0.jar, project1-1.1jar and so on.
I disagree with talonx about keeping your source non-IDE specific - by not storing IDE files in SVN along with you source you are adding extra complication to the checkout, change, checkin, deploy cycle. If you store the IDE project files in SVN you can simply check out the project, fire up the IDE and hit build. You don't have to go through the steps of setting up a new project in the IDE, including the files you SVNed, setting up dependencies etc. It saves time and means all developers are working with the same setup, which reduces errors and discrepancies. The last thing you want is for a developer to check out a project to make a small bug fix and have to spend time having to find dependencies and set stuff up.
To answer question #2 -- who's your consumer for this app?
If it's an internal app and only you (or other developers) are going to be deploying it, then what you have is perfectly all right. Throw in a README file explaining the required directories.
If you're sending it out to a client to install, that's a different question, and you should use an installer. There are a few installers out there that wrap an ant script and your resources, which is a nice approach particularly if you don't need the GUI... just write a simple ant script to put everything in the right place.
Version number is up to you -- naming the JARs isn't a bad idea. I also have a habit of printing out the version number on startup, which can come in handy.

Categories