Start a java project which uses Jargon Libraries - java

We are trying to develop a java application for iRods(a middleware for Heterogeneous databases). To use the jargon API we need to use the Java Jargon API which is in this link . We are using Java for the first time and not aware of how to import the library in our project.
In the presentation the following steps are mentioned at the beginning
git clone https://github.com/DICE-UNC/jargon.git
mvn clean install -Dmaven.test.skip=true
But I want to expose those libraries in my new eclipse project. Any pointers regarding setting up those libraries for an exlipse project would be helpful.

You are asking for a quote of the Eclipse JDT docs. But I try to give you a hint on the matter.
When you have managed to install maven and got the build running, you will find a jargon-xxx.jar in your target folder.
Take that jar file and place it in your eclipse project and select "configure build path" - "add Jar". Select the jargon.jar file in your project folder, it is now on your classpath in the project.
Hint: If this is a professional project, you need to have someone on your team to setup a proper build environment for you, possibly using maven or some other tool that manages dependencies for you and is supported in your IDE. Otherwise you can only perform manual builds of your software, which will hinder your progress really soon. You should hire someone to guide you through the first steps and get you rolling.

Related

Use Scala on computer without internet connection

I am new in Scala, so sorry if the question is absolutely obvious.
I have an Eclipse Photon installed on my computer. Would like to edit Scala code and produce runnable jars. The tricky part is that I don't have internet access on my computer (Centos7).
I bear in mind two potential issues/questions:
Downloading the plugin manually: I know, that Scala IDE plugin for Eclipse enables running Scala code/producing jars (like https://medium.com/devilsadvocatediwakar/how-to-install-scala-plugins-in-eclipse-in-ubuntu-13e53ffe3f39). Installing it from the GUI is rather straight forward. Is it possible to download a plugin bundle manually (not from GUI), move it to target computer and finally install it?
Compiling code into jars: assume that the point 1 is done. SBT or Maven requires some dependencies (e.g. Yoda time, Spark libraries) to produce specific jars - does it cause, that all the dependencies shall be moved and installed manually also?
The answer was provided by the Luis Miguel Mejía Suárez in comments:
Yes you can. For installing a manual plugin - here you can find the
zip of the ScalaIDE - and finally, use the maven repository to search
and download the dependencies JARS... However, is this really your
personal computer? or some kind of deployment server? - Also, as an
ex-user of the ScalaIDE I would recommend you to try a different,
newer IDE. For example, I just switched the last week from Eclipse to
VSCode with metals.

oData4j sample eclipse project

I have downlaoded oData4J jar files from odata.org and I intend to do a sample producer, within a basic web service.
I assumed that InMemoryProducerExample.java from http://code.google.com/p/odata4j/ will do the job and most probably it is.
My problem is that I have no clue which type of project to create (Eclipse Java), how to deploy and test this example.
Does anyone have such a start up hellow world tutorial for odata step by step, or an eclipse project which use InMemoryProducerExample.java from oData. I really need a starting point and I can see one online.
Thanks.
The easiest way to run the odata4j example is to simply checkout their project, and open it in eclipse.
If you don't have mercurial installed, install it from here.
checkout the latest odata4j code using this mercurial command,
hg clone https://code.google.com/p/odata4j/
Open the project in eclipse using the maven eclipse plugin. If you are using the latest version of eclipse, this will be installed already, it not you can install it from here.
In eclipse, go import->maven->Existing maven projects
Then select the directory where mercurial checked out odata4j.
When eclipse finishes importing the projects, you can find InMemoryProducerExample, and right click on it to run it as a java program. You can run any of the other examples in the same way.
Meanwhile, forks of odata4j which continued their lives are also available on GitHub, see https://github.com/odata4j/odata4j and my own https://github.com/vorburger/odata4j/ (which I am about to transfer to https://github.com/lukinf), which included some minor fixes for opening it in Eclipse.

Export Eclipse plugIn

I wrote my first eclipse plugin and I can export it by Export->deplyable plugin and fragments.
I'm looking for a way to export it as .jar file by command line or Ant file
(i want to add it to build proccess of some componenets)
i will appricate ant help with that!!
To do this, you will need to look into "Headless PDE Builds."
Take a look at the Eclipse PDE (Plug-in Development Environment), specifically the headless build (a.k.a., building without going through the IDE): http://www.eclipse.org/pde/pde-build/. Also, there is http://wiki.eclipse.org/PDE/Build.
Lars Vogel has some really good material on this subject from which I also learned (Thanks Lars!): http://www.vogella.de/articles/EclipsePDEBuild/article.html. As an additional note, his Eclipse RCP, Plugin, and OSGi development page has some really good articles as well: http://www.vogella.de/eclipse.html.
Also, if you would like to export for multiple platforms, be sure to download the delta pack for the version of Eclipse you are using (e.g., if using Eclipse 3.6.2, download the Eclipse Delta Pack version 3.6.2).
If you need to access any SVN repositories from within your scripts (e.g., Ant), use the SVN pde-build plugin at http://svn-pde-build.sourceforge.net/.
Lastly, run a web search containing items like "PDE headless build". There are several links to sites that cover PDE building, customizing, and execution.
Sorry for not having a detailed list of instructions but the above links should help get you on the right path.

first servlet/jsp application, just need some clarifications

I first tried the spring mvc tutorial using eclipse, but got a bit frustration and just did the first few steps using netbeans.
Netbeans, using a java web template, creates folders like:
/webpages
/webpages/meta-inf/
/webpages/web-inf/
/webpages/*.jsp
/source packages
/source packages/xxxx/xxx.java
/test packages/
/libraries
/configuration files
/configuration files/manifest.mf, context.xml, web.xml
The spring tutorial suggests to create:
/appname/
/appname/src
/appname/war (jsp's go here)
/appname/war/web.xml
/appname/build.xml
/appname/build.properties
/appname/war/WEB-INF/appname-servlet.xml
/appname/src/appname/web/HelloController.java
Now my question is, if I modified my netbeans project to mirror this structure, will it break the automatic build that netbeans gives me?
I downloaded the full version of netbeans, so I'm not sure if Ant comes with it or not?
When using the IDE's build/run, I guess I am using the IDE's build engine, can I force it to use Ant somehow or its better just to use Ant at the command line?
Here's the Spring tutorial reworked for NetBeans.
One option, becaue you have Netbeans, is to do this using Maven. Maven is an external build system (and much more) that netbeans can use. Create a new project and select a Maven project. Then create a simple Java web application (or a spring application if you want to dive right in). The directory structure that is set up will be correct.
As an Eclipse user, I'm not really good with NetBeans. But I do know that the "internal build system" is based on Ant and a pretty elaborate project framework Ant file.
You could dig your way through the maze of files and targets and fix the problem manually, but my suggestion would be to adapt the Spring tutorial's names to the directory structure NetBeans gave you.

Is Developing Maven war apps in MyEclipse worth it?

My organization has made an upper level decision to move to maven as the standard build tool for Java projects. I have been tasked with helping our local teams migrate projects over to maven.
One of the core tools that is in play is the MyEclipse IDE. MyEclipse seems to have had a "fun" history with the maven team as evidenced in various places, especially when dealing with war projects. I haven't encountered problems with simple jar projects...yet.
After fighting with MyEclipse and failing to make it recognize a war project easily, the question becomes, is MyEclipse worth it for developing maven war apps?
If so, is there a way to get MyEclipse to play nicely with a war project that I've not found? Or, am I simply better off suggesting its time to use Eclipse Java EE edition with m2eclipse?
No. MyEclipse does not support projects that were created outside of it. It is by design only working with projects created using its wizards.
From the Using Maven in MyEclipse Overview
NOTE: Maven is only supported for new projects. Migration of existing
projects to Maven-enabled projects is not supported at this time, but
may be considered for a later release. Right now the MyEclipse team is
focused on providing as fluid a new-Maven-project experience as
possible
I am working as a tech lead, and we recently started moving to maven. I had a couple of issues getting maven to work with myeclipse. First, even when I "Enabled all m2eclipse features" checkbox, I still couldn't check out a project as a maven project, from subversion. That option (that you get from m2eclipse) just wasn't available.
Also, some of the preferences you get with m2eclipse are not available with maven4myeclipse.
Finally, I couldn't just uninstall the maven4eclipse plugin and install m2eclipse. That would have been an acceptable workaround.
I think Genutec tried to make Maven more accesible to newbies, but there are some problems in the impementation, and I don't see them being fixed soon. For us, that will likely delegate MyEclipse to being just a fancy jsp editor.
Mike,
Sorry to hear you are fighting MyEclipse and Maven, in the past the most common problem I've seen causing people pain in this area is when they don't have the Web Root, Java source dirs or resource dirs set correctly.
Using this webpage as reference for a standard Maven2 web project layout, you can easily create a Maven-enabled MyEclipse Web Project. The steps you would want to take are as follows:
File > New > Web Project
Give your project a name, use the Java source dir of "src/main/java" and a Web Root of "src/main/webapp", check the Java EE spec level you want, check "Add Maven support" checkbox and hit Finish (unless you want to setup the artifact/group IDs).
Now, if this is the first time using Maven4MyEclipse, a lot of initialization will take place preparing your local repository and grabbing all the Java EE resources to build your project, but after that's done you should be all set.
You can execute the Maven targets off the Right-click Run As or Debug As menu and even manage custom goal execution using the "Maven build..." shortcut -- this is all similar to m2eclipse.
If you decide you want to use m2eclipse complete, you can navigate to Window > Preferences > MyEclipse > Maven4MyEclipse and check the "Enable all m2eclipse features" checkbox.
Out of the box we only hide the bits that can make Maven confusing for first-time folks, if you enable all the m2 bits, you can do whatever you want with Maven and MyEclipse. If you keep having trouble stop by our forums and let us know and we'll help out as best we can.
Mike,
think the issue is that the project has already been created outside of MyEclipse and >worked thru maven using the command line. Importing it is not successful.
I saw this post when looking for other Maven resources so I'll chime in.
Why not import your existing project using File > Import and turn on all the m2eclipse features and continue to develop it as you did before using maven commandline tools? I've done this and it works well for legacy projects, once m2eclipse features are enabled as mentioned in Riyad's #5.
Personally, I've always thought the maven war format was a bust, but we still have some old projects that use it around. Maven's format is just a default (and a poor one), not some sort of standard. However, we currently leave those old projects "as is" (using the above technique) just because it's easy. But for new work we use the MyEclipse web projects then just enable Maven support on them. The benefit is that you get all the Maven support and it's super easy to use and manage but no more commandline (although that still works too) and all the MyEclipse tools work perfectly on them as well. It's a "best of both" approach, well, at least for us. YMMV.
Hope that helps,
Dave
Mike,
Interesting, what happens when you have developers who are not using MyEclipse?
Not an issue here; I work for a very large company that has been standardized on it for quite some time (happily, I might add as we used to be a WSAD shop -- shudder.)
Anyway, if you have some that use MyEclipse and some that don't I see two options. First, if you create MyEclipse web projects and then "Add Maven capabilities" (or whatever it's called) to them, they'll work in MyEclipse and from the Maven commandline as well. So even if you're not using MyEclipse you can still use the commandline Maven tools. Also, since the MyEclipse structure is the more standard "exploded war" layout, it should work with whatever else you use as well.
Other thing to consider is that Maven's web layout is simply a default and Maven can easily support any project structure, including the one MyEclipse uses, so you should be able to use the MyEclipse project with Maven in any tool with just a little additional config. That's likely why the Maven commandline tools still work on the MyEclipse Web projects -- the MyEclipse guys just automatically configure Maven to recognize the format.
You also could just import the externally created Maven web projects as I said in my last post. We don't like to do that because that structure is unique to Maven and just doesn't work with any tools except Maven. As a result, it basically defeats the the tool support you get automatically in MyEclipse, Eclipse Java EE, or pretty much any other tool. It's just a poor default. Exploded WAR format, that's used by MyEclipse, Eclipse Java EE, WSAD, RAD, and everyone else is simply a better solution. Especially when it still works with Maven just fine as well.
Maven was made to be flexible to project structure. We've just found by using that flexibility a little you can get Maven support and great tool support too.
Dave

Categories