A common J2EE deployment package is a JAR file containing configuration files in a META-INF directory.
Creating this packaging during the build & deploy process is easy using a feature in JDeveloper called Deployment Profiles.
Following are the JDeveloper steps to assemble a jar file containing project class files along with xml configuration files placed in the META-INF folder.
Creating this packaging during the build & deploy process is easy using a feature in JDeveloper called Deployment Profiles.
Following are the JDeveloper steps to assemble a jar file containing project class files along with xml configuration files placed in the META-INF folder.
Let’s start with a Java Project as follows:
The SampleJavaLookup Project contains several .java files and associated several .xml configuration files.
The first step is to add a new deployment profile to the project.
Right click on SampleJavaLookup project in the Application Explorer and choose New from the menu.
In the New Gallery Dialog, select the Deployment Profile Category, and the Jar File item.
Right click on SampleJavaLookup project in the Application Explorer and choose New from the menu.
In the New Gallery Dialog, select the Deployment Profile Category, and the Jar File item.
Press the OK button.
In the next dialog, Name the profile CustomFunctionArchive and press the OK button.
This new deployment profile will define how a Jar file is created when the project is deployed.
We need to edit the new deployment profile so that the xml files are added to a folder named META-INF.
We need to edit the new deployment profile so that the xml files are added to a folder named META-INF.
To do this we will add a new Group to the profile that specifies what files need to be collected
and what directory to place them in during the Jar assembly.
and what directory to place them in during the Jar assembly.
Right click on the SampleJavaLookup Project in Application Explore and choose Project Properties.
In the Project Properties dialog select the Deployment Node in the tree to list the available project deployment profiles.
Then select the CustomFunctionArchive deployment Profile, then click the Edit Button on the right.
In the Project Properties dialog select the Deployment Node in the tree to list the available project deployment profiles.
Then select the CustomFunctionArchive deployment Profile, then click the Edit Button on the right.
Select the “File Groups” entry from the tree view and click the new button at the bottom.
Add a new group with the name METAINF.
Also set the name of the Target Directory to META-INF.
Also set the name of the Target Directory to META-INF.
Then in the left pane, expand the METAINF node and select contributors.
Click the Add button and navigate to the root folder of the project.
Selecting this path will enable any file in the entire project to be added to the META-INF folder
Click the Add button and navigate to the root folder of the project.
Selecting this path will enable any file in the entire project to be added to the META-INF folder
Finally select the filters node under the METAINF Group and deselect all files except the selected
xml files to be added to META-INF folder
xml files to be added to META-INF folder
Press OK when complete to close the Profile Editor.
This completes the definition of a new Deployment Profile used when creating Jar deployments for the project.
Finally, it’s time to generate the project JAR file.
From this point on, whenever the project is deployed, the deployment profile will assemble the JAR file as we have specified.
From this point on, whenever the project is deployed, the deployment profile will assemble the JAR file as we have specified.
Right click on SampleJavaLookup project in the Application Explorer and choose
deploy->CustomFunctionArchive to JAR file
deploy->CustomFunctionArchive to JAR file
JDeveloper creates a SampleJavaLookup.jar file and places it in the project's deploy directory.
No comments :
Post a Comment