Building RAD7 project from command line - java

We have existing projects set with compilation dependencies in a RAD7 IDE.
Is it possible to create automated build script from the existing project structure?
We have IBM portal projects and regular WEB and enterprise projects.
Maven and Ant are possible solutions but can we use these tools to build existing projects
from command line without using the IDE itself?
Also is it possible to call RAD \ eclipse core compilation from command line or API?
Thanks

You need to look into "headless mode". That's basically running the IDE to perform its work without the IDE showing up.
I don't have any direct experience but one of the teams in our lab used RAD in headless mode to automate builds for an Eclipse/System-z interface.

You can find information on headless Ant builds in chapter 23 of the Rational Application Developer V7 Programming Guide Rebook. There's more documentation in the IBM Rational Application Developer Version 7.0.0.x Information Center (which you should also be able to find in the help).

There are a number of projects already using Tycho to build Eclipse components using Maven:
There is a somewhat dated tutorial for Tycho here: http://www.sonatype.com/people/2008/11/building-eclipse-plugins-with-maven-tycho/
For more information about the Tycho development effort: http://www.sonatype.com/people/2009/03/the-future-of-maven-osgi-join-the-tycho-users-mailing-list/

Based off the answer in Build Eclipse Java Project from Command Line. You can do the following
"%RAD_INSTALL%\jdk\jre\bin\java.exe" -Dwtp.autotest.noninteractive=true -cp "%RAD_INSTALL%\startup.jar" org.eclipse.core.launcher.Main -application org.eclipse.jdt.apt.core.aptBuild -data "%WORKSPACE%"
Where you configure the variables %RAD_INSTALL% to your instance of RAD and %WORKSPACE% to the workspace which houses the projects you want to biuld.

Related

Java beginnings using Netbeans

I'm just about starting to learn Java. Reading about, I installed Netbeans.
Running Apache Netbeans IDE 11.2.
The Java version is 13.0.2.
I'm promptly follow the Quickstart guide on the netbeans website.
File>>New project>> Java >> Java Application.
Errhmm, I don't have this 'Java' option. All I have is
So what's the difference between Java & Java with Maven/Cradle/Ant . At this point in time, I intend to start with basics of Java programming and then move on from there. SO which option am I meant to be starting with? If I'm missing Java, how can I add it ? Going through the installation procedures didn't give me any option to choose from.
p:s - this is all running on Mac OS Catalina
You can start with any of Java with ... option. I use Java with Ant option.
Maven, Gradle, Ant are build-tool addons i.e. they provide additional support if you intend to use any of these as your build tool.
When you choose Java with Ant option, it will let you create, compile, debug and run your Java programs without requiring anything additional. After using this option, you will get an interface as shown in the screenshot given below:
Maven, Gradle and Ant are build tool which allows you to compile, unit test, package and (if you like) even deploy your Java applications (they do support other languages btw).
I suggest you to start with one of those (Maven is very popular and probably a little bit easier than the others) instead of relying on your Java IDE specific features.
Once you master a build tool you can change IDE (IntelliJ is also a very good option ;-)) and will still work as before. You also find plenty of resources and help (like Stackoverflow) if you need hit some problems.
Best of luck!

How to create Java project in Netbeans, without using Maven as default?

I'm currently trying to create a basic Java project. The first option that appears is "Java with Maven", which I already used, but isn't giving me the "Create Main Class" option that I need.
I'm using Apache Netbeans IDE 11.0, running on Windows 10, x64.
I've given it a whole day, updating and installing the most recent JDK versions I found, and still I'm unable to make it work.
I've also read this answer, but it's not working:
Can't create project on Netbeans 8.2
Here's an image of what I'm getting:
Any help is appreciated, thanks.
The project templates were revised in Apache NetBeans 11.0 to give Maven projects greater prominence. From an Apache NetBeans blog post:
Restructuring of Project Templates in Apache NetBeans
There's been lots of discussion in the Apache NetBeans community about
how best to express the fact that Apache Maven and Apache Gradle are
more modern choices to be aware of than Apache Ant, while at the same
time not implying that there's anything wrong with using Apache Ant.
Here's what we seem to have reached consensus around, i.e., move all
Ant-based project templates into a separate Ant-specific folder, while
putting the other two build systems higher and therefore more
prominently in the list:
With the above, someone is less likely to simply go to the
no-longer-existing Java category and then end up with an Ant-based
project, without thinking about it. By default, the user of Apache
NetBeans is now encouraged to consider Apache Maven and Apache Gradle
first. The old Ant-related categories are still there, so as not to
confuse anyone completely, just structured within a lower ranked "Java
with Ant" category. The above also solves the discussion re "Java EE",
i.e., here the idea, from discussions, is to name the category "Java
Enterprise".
At startup, all categories are closed, i.e., none is more prominent
initially than any other.
An objection one could have is that, if you're a complete Java newbie,
you won't know what Maven, Gradle, or Ant are. Well, that has always
been the case and NetBeans has artificially hidden that choice by
having a category simply named "Java", which then resulted in everyone
ending up with Ant-based projects. To turn that around and have a
category simply named "Java" that results in Maven-based projects is
probably not right either, i.e., a careful balance needs to be struck.
So if you created a project using File > New Project... > Java > Java Application in earlier releases of NetBeans, you should use File > New Project... > Java with Ant > Java Application in NetBeans 11.0.
Notes:
NetBeans Bug Report NETBEANS-2040 Maven First in New Project Wizard refers.
Also see the discussion at the start of this YouTube video The Rough Guide to Apache NetBeans 11.0.
Other project wizard changes in NetBeans 11.0:
In NetBeans 11.0 I had to install the Gradle plugin (Tools > Plugins > Available Plugins > Gradle) in order to see Java with Gradle in the Project Wizard.
In earlier releases of NetBeans you created a Java Enterprise project using File > New Project... > Java EE > ..., but in NetBeans 11.0 this has changed to File > New Project... > Java with Ant > Java Enterprise > ...

Issues with Eclipse setup on Ubuntu 12.04

I am facing setup issues in my eclipse Kepler on Ubuntu 12.04 on Virtual box.
Firstly i was facing issue same as:
Eclipse Open declaration in Java project
I tried everything mentioned here, but nothing seems to be working for me...
Then I explored some more, and get another error message similar to:
I am getting resource not on the buildpath of the project
As per its 1st answer, 2nd point go to "Java Build Path", I tried going there, but i cannot find any "Java Build Path" section in my project property.
When I click on Project properties, it shows only options given in the following screenshot:
I know this is some easy setup issue, but i am unable to handle it.
The answer is a write-up of the discussion in the comments:
If you are on Ubuntu 12.04 and install Eclipse you could end up with a bare-bones install without the Java Development Tools (JDT).
After installing the package manually via Help -> Install New Software and then searching for Programming Languages / Eclipse Java Development Tools Java development should work.
For maven projects you should use the import Existing Maven Projects instead of importing it as a java project.

Java Build; with these requirements, what would be a good choice?

This is in regards to building a Java Project.
So I'm a bit confused on my options here.
My requirements (it's a small project):
Needs to compile Java project with specific/custom compiler arguments
Project has native libs that need to be included
need to compile javascript->java class via Rhino javascript compiler (https://developer.mozilla.org/en/Rhino/JavaScript_Compiler)
After the build I need to run another command: ProGuard (http://proguard.sourceforge.net/)
run javadocs
Package everything up in Jar (also including external data, ie, images, xml, ini, etc)
Build/create a .jnlp web start.
Available under both Win and Linux would be optimal.
this is a hobby project, so don't want to spend weeks learning/managing the build system. At most an 8-12 hour investment start to finish (otherwise it's just better to keep doing everything by hand).
btw, my IDE is Eclipse if it matters; a nice integrated plugin would be nice - but not required.
So far I think Ant and Maven are the main two build systems in use. It's very unclear to me though which one I should use or how they differ?
The other option would be 'make' under linux (or maybe cygwin). I've only used it once, but seemed pretty quick to get going/working. Is that a good option for Java or this project? Any downsides to make? Why don't more java developer's use it?
Other options?
In a nutshell: spend your 12 hours learning and using Ant.
Maven has a good feel out-of-the box, super-easy to get going and with the neat dependency management, but down the line tweaking the pom.xml (your project's maven build file) to fit your needs will require more fiddling with than if you used Ant.
To address some of your specific requirements:
you can use <compilerarg> elements with the <javac> task
for native libs you can add them with: <sysproperty> and key="java.library.path"
use Rhino with Ant (http://stackoverflow.com/questions/3526960/using-recent-rhino-in-ant-script)
there is a Proguard task for Ant (http://proguard.sourceforge.net/index.html#/manual/ant.html)
for javadoc Ant comes with the <javadoc> task out of the box
the <jar> Ant task is extremely easy to use to package everything up
there is a <jw:jnlpwar> task available from the [Ant Web Start Task project] at (http://ant-jnlp-war.sourceforge.net)
Ant is ubiquitous, it works for just about every major platform out there (Linux, Unix, Windows, MacOS)
with plenty of docs and examples available on the web, you'll pick-up Ant in no time, and those hours you'll spend learning it will probably "pay" themselves back within a couple of weeks of using it for your builds.
Eclipse integrates with Ant out of the box (http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.platform.doc.user/gettingStarted/qs-81_basics.htm)
It may not do fancy dependency management out-of-the-box like Maven (although for that you can integrate Ant with Ivy) but it certainly provides you with all the flexibility you'll ever need, and you won't find yourself "fighting" the build tool configuration file as it's fairly common with Maven.
I should probably just mention the 2 new names in Java build (and CI) tools: Hudson and Jenkins. They're fairly recent and may be interesting to look at, but I would definitely not recommend them to you and your project at this early stage.
Note: apologies for the lack of real links (only allowed 2 links atm)
Maven is the best choice here as it has integration for all of these
so go for it.
Here, quick links for you to save an extra hour to spend on learning maven ;)
Maven Compiler Options
Native Maven Plugin and Projects with JNI
Use Maven Antrun Plugin to Run rhino compile ant task
Use Proguard Maven Plugin (further details)
Maven Javadocs Plugin
Maven Assembly Plugin
Webstart Maven Plugin
Its java based so supported by most OS that support java !
It depends how quickly one can learn but AFAIK 12 hrs is sufficient to get started

Importing Liferay portlet into Eclipse IDE

I have a question regarding the development of liferay portlets using the liferay plugin SDK. My question goes mainly in the setup of the development IDE. The suggested one would be to use Netbeans IDE which I also tried out, but it appears to run very slowly on my machine while Eclipse is quite performant.
The setup for Netbeans IDE is the following
Go to the directory \portlets
Run the create.bat (or sh file depending on the OS) to create a new sample portlet
Run Netbeans IDE, create a new "Java free form project" and point it to the directory of the created sample portlet
That's it, pretty simple.
For the mentioned reasons above (and because I'm a lot more familiar with Eclipse) I'd like to import the project into Eclipse the same way. Is there a way for doing it without having to change too much in the original structure of the created sample portlet and the according build.xml (ant file)?? I tried already to create a new project out of the build.xml ant file of the created sample portlet, however in this way it doesn't include me the source code.
I didn't also find great tutorials on the web...
Could someone help me with this, pointing out online tutorials or give me some hints.
Thanks
I know your pain. Starting to work with Liferay needs much time. I you do not want to edit the existing source, but only crate your own portlets, you can download the plugins SDK from the 'Additional Files' section on the Liferay website. This provides ant scripts, to create a simple JSR compliant portlet, and to create all necessary things, to create a sound Eclipse project, for example:
ant -Dportlet.name=<project name> -Dportlet.display.name="<portlet title>" create
Than cd into the directory of your created portlet an do:
ant setup-eclipse
After that you should be able to create a new project from the sources in that directory in Eclipse, which can then be deployed via another ant script to the running tomcat instance. If you already know somthing about portlet programming, you shoud be pretty much settled now. If not, try to find documentation about JSR portlet programming first, before looking into Liferay specifig portlet development.
Liferay has now released an official set of Eclipse plugins that support portlet development. Here is the installation guide for installing the eclipse plugins:
Liferay IDE Installation Guide
Also there is a getting started guide that shows what to do after installation to actually setting up your first portlet project.
Getting Started Tutorial
Liferay IDE uses the Plugins SDK from Liferay under the covers to do all the work. If you already have existing projects that you created with the Plugins SDK those can be imported into Liferay IDE as well.
Importing existing Projects
you can find the tutorial for deploying liferay in eclipse
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Development+Environment+(Windows)
No clue about Liferay's specifics, but in general, I'd do this:
Follow the steps 1 and 2 from your NB setup list
Create a new Dynamic web project (or a Java project if you don't need the web project's features) in Eclipse
Import the contents of sample portlet directory by doing Import -> File system in Eclipse
Adjust the project's Java source directory to point to the generated sample portlet source directory (that should now appear in your project)
Adjust classpath of the project, point it to LR lib folders, ...
If there's a generated build.xml, check if it can be used to deploy to LR, or to produce builds.
As of March 2011, there is some official Liferay support for NetBeans and as noted before, there is official support for Eclipse ( In the Marketplace). The Documentarian uses Eclipse himself, though many examples just use the Plugins-SDK with shell scripts, ant scripts and no IDE.
We are fighting with Liferay on Eclipse, Eclipse seems buggy and unpredictable, but we are also new to J2EE and Eclipse ( so discount this last comment a bit), and I have our portlet files setup in a separate area for SVN, requiring a refactor-move, refactor is definitely buggy.
You should be aware that there is a book for developers on the way from the official documentarian - we've bought the early release and found it useful. He does cover some IDE issues. See Manning press.
The Liferay sample portlets ( there are many) are not set up for Eclipse projects, and you'll have to import some java files and jump through some Eclipse hoops to get them into a running Eclipse project you can develop.

Categories

Resources