Process of install the Junit library in Eclipse - eclipse

Good morning guys,
what I am considering about is to build a standard process of installing a library in a java project in eclipse. I am a niewbie software developer so a prior sorry if this question is a bit stupid.
All what I want to do is to use the junit library. I have followed these septs.
I installed the junit-4.12.jar file from the web.
Inside the project folder I created a new file and I named it "lib".
I put in this folder thae jar file and then in eclipse I click
on project folder -> properties -> Java build path and I click on libraries and add jars. (not external jars).
Is that process ok?

your process isn't good because it doesn't scale: imagine you want to install 40 libraries in your project. and then imaging your team has 5 developers and each of them has to do the same. and what about CI server that must be automatic
in fact your problem was solved years ago and the solution is called 'dependency management tool'. those tools are usually built into something more powerful called 'build tool'. maven or gradle are examples of such tools. you just provide list of your dependencies (like junit) and that program automatically downloads them and build your project. and it's sufficient as long as your project is more less 'typical'
i don't remember if eclipse has build in support for maven (one of the oldest and most common). if not, just install the eclipse plugin and you're ready to go

Related

How to build and install an Eclipse plugin using ant

How do I build and install an Eclipse plugin using ant? I want to build a plugin as a zip file and then install the plugin on 32bit or 64bit eclipse. What am I supposed to do here?
Indeed, using PDE/Build to achieve a so-called headless build is difficult, but not impossible.
We are still building our RCP this way.
I recommend reading Paulin's and Sharma's tutorials on the issue.
The Eclipse PDE has its own builder which is built on ant. I'm not sure from your question if you are looking to simply build/export your plugin within eclipse or generate ant build scripts that can be run outside of eclipse. The latter is more difficult. Inside eclipse you can simple go to file -> export -> Plugin-Development -> Deployable plugin and the export wizard will walk you through it, you can select to deploy a zip or exploded directory and then select output location and presto you have your plugin built as a jar that can be dropped into an eclipse instance. If you are looking to use ant outside of eclipse to build you need to go through a series of steps that are complicated to get a 'headless build", if this is what you need to do Google "pde headless" build. I've tried it but gave up. There is also a good book "Building highly modular systems with OSGI/Equinox that has a chapter devoted to this. - Duncan

Netbeans won't let me change a project's Netbeans platform

I've downloaded the VisualVM source and am trying to compile the Glassfish plugin using Netbeans 7.01. Doing so results in the following error:
C:\source\visualvm\trunk\plugins\glassfish\nbproject\build-impl.xml:48: You must define 'nbplatform.VisualVM_100609-dd12ae64a19c.harness.dir'
That lead me to the project settings which shows the platform as "Netbeans IDE...". The drop down box is grayed out so I can't select the correct platform.
Yet, on my hello world VisualVM plugin I can set the platform to the appropriate platform and it runs great.
To try and resolve this I've tried creating platform.properties file and putting it in the nbproject folder with the following entries. However, this doesn't seem to be working
harness.dir=mypath/visualvm/visualvm_13
and
nbplatform.VisualVM_100609-dd12ae64a19c.harness.dir=mypath/visualvm/visualvm_13
Any suggestions.
Glassfish plugin is part of 'plugins' NetBeans modules suite. All modules from a Modules suite has to be build against the same version of NetBeans platform application (in our case VisualVM). This means that you can change the NetBeans Platform for the whole suite, go to the properties of the 'plugins' suite a change the platform there.
In order to build the VisualVM and it's associated plugins you must download the NetBeans platform and profiler binaries that are available on the VisualVM website's build guide section.
For example, to build the 1.3.2 release you would go to this section and download the NetBeans 6.9.1 platform and profiler binaries available through the link located on that page. The link I've provided also gives you instructions for obtaining the proper VisualVM sources from the repository and building VisualVM and it's plugins. For example, the sources for the 1.3.2 release can be checked out using the following url:
https://svn.java.net/svn/visualvm~svn/branches/release132
And once you've completed the checkout and extracted the NetBeans platform binaries (downloaded from the above link) into the
release132/visualvm directory, you can build the entire application and it's plugins by running ant build from the release32/plugins directory.
I successfully completed this entire process and can verify that the instructions work for 1.3.2. However, the instructions for building the trunk did not result in a successful build due to at least one missing dependency.
What the error that you were seeing was telling you was that the NetBeans platform's build harness could not be located. The harness is included in the downloadable binary and once you've extracted it into the release32/visualvm directory the values that are in the project.properties file will once again be valid. This is of course a good example of why you should keep everything needed to successfully reproduce a build in your repository!

Platform-specific dependency creeping into Eclipse plugin

I have implemented a graph editor with Eclipse EMF and GMF frameworks. After completing my project, I realized that this plugin shows dependencies (not explicitly added by me) on some OS-specific plugins.i.e:org.eclipse.ui.win32, org.eclipse.swt.win32.win32.x86. And whenever I have tried to bypass this dependency at my update site something went wrong with the installation process of the plugin.
As such it is impossible to run my plugin in *nix environment or even win64 machines.This seems a very heavy constraint dependency to me. Am I doing something in a wrong way? Or is there no other way of building Eclipse plugins which are cross-platform other than building the project from scratch at each different OSs?
We created a similar style of plug-in in my project. Under "Plug-in Dependencies" in Package Explorer I can see org.eclipse.swt.win32 listed, but it is not listed in required plug-ins in plugin.xml.
We also successfully created an update site which works for Mac users without issue.
So, yes it is possible to have a cross-platform plug-in.
I would suggest you first try to to use "Export..." -> "Deployable plug-ins and fragments" to create a bunch of jar files for your plug-in. See if these can be successfully installed by copying into the drop-ins folder of a fresh eclipse installation. Do this first on a Win32 install, then try on another platform. Once you have that working, use the new Eclipse installation to create the Update site.

EAR packaging and publishing in Eclipse using Ant builder to build the dependent modules

I have a requirement where the individual modules are built using ant and the resulting jars should be used by eclipse to package the ear and publish on JBoss server.
I wrote ant script that builds the dependency modules and puts under project/build/artifact directory. And used the jars under this directory to provide Java EE module dependencies.
The packing seems to work fine if the dependencies were added after the modules were already generated. But when another developer takes my changes and tries to get this working, the dependency modules are not recognized because the modules were not created yet.
After building the modules and refreshing the project workspace, the modules be recognized and added to the ear. But the module dependencies were not shown until I pretended to modify the component file (added a new line or a space and saved it - not really modifying the content) and did a project refresh and it worked. I searched on eclipse to see if this is an existing bug, but didn't find any relating bugs.
Am I doing something wrong here? Is this approach the right approach to get the modules built by ant and use them in packaging an ear and publish it using eclipse? Please help.
This is likely a bug in WTP, but..
I would keep Ant and Eclipse builds away from each other. Use your Ant script to produce your "official" builds for production. During development do not try to feed result of Ant build into Eclipse build. Do this with direct project-to-project Java EE module dependencies instead.
The only time that it is really necessary to get Ant involved in the Eclipse build is when you need to integrated external compilers or code generators into the build process.

Eclipse Automatically Download / Update JAR files

I just created a Web App project from a repository through Eclipse's SVN support. What I would be doing is have an ANT build going and then finally deploy through Tomcat.
I am using Eclipse IDE for Java EE developers on an Ubuntu system.
There are a number of jar files needed
to support my project - like Struts,
Hibernate, etc. etc.
Do I need to
manually download each of them
and put them in the lib folder?
OR
Does Eclipse have a solution to
automatically UPDATE these from the internet? Any plugins to automatically take care of this?
You should consider using Maven for your project. It's VERY well supported in Eclipse, and handles all dependencies (as well as other things, such as releases).
The problem is there's a bit of a learning curve, but if you intend your project to get to a considerable size, I'd say it's very important.
Maven has support for ant builds and most libraries are in the central Maven repository. You just say your project has a dependency on the external project and it will automatically download the dependencies.
http://maven.apache.org/