In Part 1 I covered all you need to know in order to setup and run the AW application using standard AW tools. Now we will go to the next step that is setting up AW project completely inside your IDE without including any AW tools.
The reasons you might want to do this are:
- It's fun & useful to figure out how get "under the covers" of how AribaWeb is deployed, especially if you're using AW in a larger project
- Speed: you can squeeze the turnaround-time some if you unbundle the ANT deployment scripts -- useful when you're doing a lot of restarts of the app server during intense development
- You may want to change the defaults on what goes where in the folder structure
- Hey, maybe you want to "gradle-ize" your AW installation?
First time
setup and Project Layout
The first thing we will start with is the layout of the project. I think you do not want to have everything in one directory but you want to have layout that gives you flexibility on where you put resources, java files, test files and others.
When I said that we would work with the IDE I meant IntelliJ IDEA but I think eclipse users can do something similar as well. The first setup is manual but once it’s done you will appreciate the speed.
I expect that you are already IntelliJ IDEA user because I am skipping some of the steps here. This article is not guide how to use this IDE rather how to develop AW application in this IDE.
Initial Setup
Once your project is created this should be your initial setup:
And now lets get back to the layout. As you know each real project has it’s own specific structure that lets you well organize your resources. In IDEA please create following layout:
This is something we can start with. No more one-directory layout but structured project that is divided into two areas main and test. I think the names describe themselves.
Directory
|
Description
|
ariba |
Here I put all the ariba resources directories where the locales are stores. The reason for this is that you need to be able to work with these files maybe change or fix translations or even extend it (override it). You do not want dig all this inside jar files and all the time rebuilding the AW distribution. This is something, which needs to be available.
|
config |
This directory plays two roles:
|
java | |
webapp |
This simple layout lets you organize your files well. Since AW relies on specific structure as I already mentioned in Part 1 so the next thing you need to do is to extend AWServletApplication and specify where to look for files.
But before we do some programming we need to add some libraries into the project so AW classes are recognized.
Adding AW library. I already created global library so I do not have to do this for every single project |
Finish the awl application
First thing to do: extend the servlet and AW application |
FILE
|
Description
|
MainDispatcherServlet |
This is your custom servlet file that returns reference into your custom application.
|
WebApplication |
This is the heart of your application. Here we need register our custom directory structure so the RapidTurnaround works even for this setup. Also we are overriding method to retrieve application name. Now the URL will be:
http://<host>:8080/example/Main
instead of /example/AribaWeb |
java |
Here are your java files.
|
webapp |
Into web app I put web.xml that refers to our custom servlet.
|
docroot |
This is directory containing your static web resources. Here you have your css files and branding images if you need to.
The only thing you need to do is to take already assembled docroot directory from one of the examples. This is one time operation.
|
After little coding we have created little project, which looks like this:
IDE Project pane showing created files as well as how files are organized |
Create Artifact
Now it is time to create thing called artifact. Basically we tell the IDE how to build and pack the application for our development purposes. Artifacts are created inside your IDEA project settings.
We are starting with directory structure:
Final directory structure for the deployment |
Do not forget to update your resource patterns for compiler. Otherwise your .oss or .awl file would not be moved to the output directory.
Tomcat Setup
The only thing that is left is to setup Tomcat application runner, which needs know what artifact to use, and we are done.
Here is the tomcat configuration:
Select that artifact + what context path should be applied for this webapp |
We can also enable RapidTurnaround by adding ARIBA_AW_SEARCH_PATH variable.
Setting up Tomcat with extra env. variables. |
Run and Debug
Now the final run or debug.
Once we have everything configured we can simply click on Run/Debug just in any java application |
Using AW tools you are able to run your application as external process and then you used remote debugger to connect to the application.
In this method (Without AW tools) you are running IDEA tomcat process, which is all built-in and what is more important you have full control over the application now.
Do not be mistaken I still use build scripts (we are using currently grandle) that manages the process for the continuous integration server but for the development it is only IDE.
In this article I tried to show you different ways how you can structure and develop your real AW application where the key points are:
- Full control over the application not the other way.
- You need to know all the magic behind. Not rely on high-level tool.
- Directory layout for real application.
- You need to understand if you rely on the ant script you always run the full cycle (clean, compile, build, war, start, etc…) and if you have really large application this can be time consuming. In my case you really focus on the development because you do not have to wait if you changed something for the whole build cycle in order to startup the application again.
- If you look at the project you can see one file called pom.xml, which I use as a library loader and checker. You do not have to use maven only for building project. In Idea you can use maven to monitor dependencies between your libraries and it can also automatically update your project settings with jars from the pom.xml.
Other areas to investigate:
Once again to finish up this article here are some points that you can check out in order to extends the capabilities of this project.
AWConcreteServerApplication. registerResourceDirectories():
This one is responsible for scanning all of your directories and jar files and registering all your resources.
This one is responsible for scanning all of your directories and jar files and registering all your resources.
If you want to really speed up the development process you can integrate JRebel. This little tool let you do hotswap even on classes where you add or remove methods or properties and even more.
We created ariba and config directory for specific reason that is to support extension of the application and branding. When you check out this method you will better understand how AW lookups its resources.
When I mentioned that I am using the grandle please have look how such build file might look like to compile & build whole AW project:
build.grandle example |
Hi, I am starting a failrly big project and chose this framework to play/start with. Being completely new (read ignorant) I am trying to follow this guidline, but with it being images, one can not see the code completely and that makes it difficult to follow/understand.
ReplyDeleteI am trying to do the same using Netbeans, by the way.
I also want to know if it is possible to "get rid" of Hibernate completely, maybe by using a different 'Initializer" ?
I am a bit stuck at the moment. Can I send a copy of my NB project for help?
Hey Anton,
ReplyDeleteNot sure is somebody replied to you yet ?
FK
Nope, still stuck. I managed to get past the not running at all to a page coming up with the AribaWeb logo and message 'Exception Encountered' but I can not trace the error. I suspect some library/resource is missing, but debugging reveals nothing. I really would like to use this framework, so any help will be great...
DeleteIn the meantime I have started looking at others, like Yii, Wavemaker and EmberJS, but still early days...
Hi,
DeleteI have personally started pretty large project and I do not use nothing like hibernate,
I use graph databases and document databases.
Once I will be on the other computer and I can send you the project structure. I do not have it here. Also for some reason
when you post comment I do not receive it. Not sure what is wrong. Easier to ask on the forum this is spamming me even on mobile
so I can react faster.
To get rid of this Initialier please do not include metaui-jpa with the project then it will not be called.
on the forum search for the persistence.xml - people were asking similar questions.
I would start with sending you the copy of my project structure and we can go from here.
FK
Hi Frank,
Deletecould you kindly send a copy of your project struct also to me_
Many Thanks,
gd
anything like this: 'Exception Encountered' but I can not trace the error. I suspect some library/resource is missing, b.
ReplyDeleteyou are right it might be. 1st thing take this under control have most of the file under your structure and you are fine.
Yes good blog creation and keep update..
ReplyDeleteMobile Website Development Mumbai
ReplyDeleteartikelnya sangat membantu gan thanks for sharing :)
Your post was very nice and informative, thank you so much.
ReplyDeleteIklan Gratis
Pasang Iklan
Pasang Iklan Gratis
I'm glad to hear that, sap ariba. Good luck to you. Blogging is a great thing, and you get better with practice. sap ariba training in Hyderabad One of the best ways to grow is to read other people's blogs. See what they do, how they do things. It's always food for thought, and sometimes, it's downright inspiring.
ReplyDeleteThe Grand Hotel, Casino & Skypod - Mapyro
ReplyDeleteThe 포천 출장안마 Grand Hotel, Casino & Skypod - Mapyro Hotels, 창원 출장샵 Casino & 공주 출장마사지 Skypod is a Casino & Skypod location in the centre 밀양 출장샵 of 파주 출장마사지 Las Vegas, Nevada.