In this blog post, I will show the high level steps to automate the build process for fusion web applications, built using JDeveloper. This applies to JDeveloper 11g as well as 12c. I will demonstrate this process using the Work Better application provided by Oracle and our FlexDeploy DevOps solution.
- Application is stored in SubVersion as folder name WorkBetterFaces.
- Application name is also WorkBetterFaces.
- Application deployment profile is also named WorkBetterFaces.
- This is not a requirement for FlexDeploy, but it simplifies processes if all your applications adhere to common convention, which allows you to create single workflow process to build all your ADF applications.
Application is checked out in JDeveloper 12.1.3 and application deployment profile includes war deployment profile from ViewController project. Generated EAR file should contain WAR module along with other deployment descriptor files.
By default, JDeveloper will generate JDBC resource files in META-INF folder of EAR file. JDBC resource files represent data source to be used at runtime for ADF application. This works perfectly when running in embedded WebLogic server, but as it contains encrypted password for embedded WebLogic domain, it will cause deployment to fail when deployed to remote WebLogic server. You can either
- Not generate JDBC resources in EAR file and manage Data Source using Admin Console or WLST
- Fixup JDBC resource in XML file with properly encrypted password prior to deployment to WebLogic server.
In this post, i will use Option 1 of not generating JDBC resource files inside EAR and for that I will utilize FlexDeploy capabilities. This allows me to run application without any Data Source setup in JDeveloper, but at the same time i can deploy to remote WebLogic server and administrator can manage Data Source setup independently.
FlexDeploy allows users to create reusable Workflows to perform Build or Deploy activities. These workflows can be reusable across many projects in your enterprise. FlexDeploy also provides many plugins which simplifies creation of Workflows. See below workflow for building EAR file from JDeveloper application.
- Export project sources from SubVersion. This step can be replaced Git plugin call, if you are using Git.
- Tag project sources. This is best practice to make sure that we can identify exact source for generated artifact (EAR file). FlexDeploy captures Revision number for SubVersion repository when Build request is generated, which is used for both export and tag operations.
- Details of SubVersion repository URL, User, Password, Project source and tag path etc are configured in FlexDeploy by developer and is not hard coded in this Workflow.
- Final step, Build application. This plugin has input which can be unchecked to make sure that JDBC resources are not generated.
Now we are ready to perform Build. As shown in image below, you can use Build action to initiate build workflow execution. FlexDeploy will execute workflow on Endpoint where you have JDeveloper installed with necessary extensions. JDeveloper is executed in headless mode to run deployment profile(s) to generate artifacts. You can monitor status of request from FlexDeploy UI and examine log messages as well. For example, if there is a compile failure you can look at logs in FlexDeploy to understand what may have caused compilation problem.
You can also setup Poll on your SubVersion repository to automatically initiate Build Request when code is checked in.
FlexDeploy also allows you to download generated EAR file. I have download this locally and as you can see in image below, generated EAR file does not have any JDBC resources. Now this EAR can be deployed on WebLogic managed server without any issues.
This process can also be used to generate ADF Library jar files, which can be consumed by developers to build more complex applications.