{"id":32886,"date":"2017-06-06T04:15:05","date_gmt":"2017-06-06T12:15:05","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/?p=32886"},"modified":"2019-02-14T15:51:35","modified_gmt":"2019-02-14T23:51:35","slug":"building-and-deploying-a-java-application-to-oracle-weblogic-server-running-in-azure-vm-with-microsoft-visual-studio-team-services","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/building-and-deploying-a-java-application-to-oracle-weblogic-server-running-in-azure-vm-with-microsoft-visual-studio-team-services\/","title":{"rendered":"Building and Deploying a Java Application to Oracle WebLogic Server Running in Azure VM with Microsoft Visual Studio Team Services"},"content":{"rendered":"<p>If you are interested in Microsoft Visual Studio Team Services (VSTS) platform and <a href=\"https:\/\/visualstudio.microsoft.com\">Java development<\/a>, maybe you know that VSTS has everything you need to organize CI\/CD pipeline for your Java application development. Visual Studio ALM Blog <a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2017\/04\/25\/how-to-build-and-deploy-a-java-web-application-using-team-services-and-azure\/\">has a lot of useful and helpful resources<\/a> describing how to build and deploy your Java application and artifacts to Azure App Service or Azure VM running lightweight open source Tomcat or Jetty servlet container with VSTS. But what if you are going to use\/using enterprise grade Java EE application server like <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/virtual-machines\/linux\/classic\/oracle-images\">Oracle WebLogic Server in Azure VM<\/a> and you have a requirement to seamlessly integrate it with your VSTS CI\/CD pipeline? Quick answer is: \u00abyes, it is possible\u00bb. Microsoft VSTS has very flexible mechanism of build\/release definitions which allows you to configure your CI\/CD pipeline according your requirements and compile, build and deploy your Java EE application to Oracle WebLogic Server. In this article, I will consider the basic steps you need to do to configure your infrastructure for WebLogic deployment.<\/p>\n<h2>Prerequisites<\/h2>\n<p>In the world of Java development, <a href=\"https:\/\/maven.apache.org\/\">Apache Maven<\/a> is a well-known and proven build automation system for simplifying build process for Java projects and widely using by Java developers. Oracle WebLogic Server also provides support for Maven through the provisioning of plug-ins that enable developers to perform various operations on WebLogic Server within a Maven environment. The task of automated deployment to local\/remote WebLogic Server instances was simplified since Oracle updated Oracle WebLogic Maven plugin and made it available in <a href=\"http:\/\/docs.oracle.com\/middleware\/1213\/core\/MAVEN\/config_maven_repo.htm#MAVEN9010\">Oracle Maven Repository<\/a>. WebLogic Maven plugin (weblogic-maven-plugin)\u00a0provides functionality to install, start and stop server instances, create domains, execute <a href=\"https:\/\/docs.oracle.com\/middleware\/1221\/wls\/WLSTG\/using_wlst.htm#WLSTG118\">WLST<\/a> scripts, and compile and deploy Java applications. You can find out more details about its functionality in <a href=\"https:\/\/docs.oracle.com\/middleware\/1221\/wls\/WLPRG\/maven.htm#WLPRG585\">official WebLogic Maven Plugin documentation<\/a>. Good news that you may not install this plug-in manually now, instead of this you can use <a href=\"http:\/\/docs.oracle.com\/middleware\/1213\/core\/MAVEN\/config_maven_repo.htm#MAVEN9010\">Oracle Maven Repository<\/a>. Alternatively, you can configure the plugin manually if you do not want to use remote repository. To start it usage you <a href=\"http:\/\/docs.oracle.com\/middleware\/1213\/core\/MAVEN\/config_maven_repo.htm#CACJADFE\">must accept license agreement<\/a> and make some modifications in your Maven settings and project POM artifact. We will consider basic steps in this post, but you can find more details <a href=\"http:\/\/docs.oracle.com\/middleware\/1213\/core\/MAVEN\/config_maven_repo.htm#MAVEN9013\">in official documentation<\/a>. In our case, we are going to deploy our private VSTS Build Agent running on Azure VM instead of the VSTS hosted agent. Then we need to make some modifications in Maven configuration to access Oracle Maven Repository.<\/p>\n<p>Microsoft Azure platform supports <a href=\"https:\/\/azure.microsoft.com\/en-gb\/campaigns\/oracle\/\">Oracle Software<\/a> including <a href=\"https:\/\/azuremarketplace.microsoft.com\/en-us\/marketplace\/apps\/Oracle.OracleWebLogicServer12cEnterprise\">Oracle WebLogic Server<\/a> to run enterprise grade Java EE deployments. Despite WebLogic Server Infrastructure deployment in Microsoft Azure is out of the scope of this article, you can find all required information in <a href=\"https:\/\/docs.oracle.com\/middleware\/1212\/wls\/WLAZU\/toc.htm\">official documentation<\/a>.<\/p>\n<p>In our case, I am using use Azure VM running Oracle WebLogic Server Quick Installer Distribution with one Admin Server instance listening <strong>7001<\/strong> port number and WebLogic domain is configured in development mode. But feel free to experiment with your custom WebLogic Domain configuration for more complex deployments.<\/p>\n<h2>Infrastructure configuration<\/h2>\n<h4>Step 1<\/h4>\n<p>Before provisioning of VSTS Agent VM we need to create an <a href=\"https:\/\/www.visualstudio.com\/en-us\/docs\/build\/concepts\/agents\/pools-queues\">agent pool<\/a>. Login to your VSTS account, go to <strong>Settings<\/strong> menu and then to <strong>Agent Pool<\/strong> Click <strong>New Pool\u2026<\/strong> and then enter the pool name. Remember and note your pool name since we will need it during VSTS Agent VM provisioning.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS1.png\"><img decoding=\"async\" width=\"843\" height=\"425\" class=\" wp-image-33075 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS1-1024x516.png\" \/><\/a><\/p>\n<h4>Step 2<\/h4>\n<p>Now we need to provision VSTS Agent VM with all required software components for building of our Java web application. To simplify this step, instead of manually creating Azure VM, I\u2019ve prepared an <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/azure-resource-manager\/resource-group-authoring-templates\">Azure ARM Template<\/a> which will create <em>Oracle Linux 7.2<\/em> <em>VM<\/em> and run the shell script to install all required components for building and deployment. You can find <a href=\"https:\/\/github.com\/easkerov\/vsts-agent-vm-weblogic\">ARM template artifacts on GitHub<\/a>. To deploy VM using your Azure subscription just simply click button below:<a target=\"_blank\" href=\"https:\/\/portal.azure.com\/#create\/Microsoft.Template\/uri\/https%3A%2F%2Fraw.githubusercontent.com%2Feaskerov%2Fvsts-agent-vm-weblogic%2Fmaster%2Fsrc%2FvstsBuildAgentWLSOELTemplate.json\">\n<\/a><\/p>\n<p><a target=\"_blank\" href=\"https:\/\/portal.azure.com\/#create\/Microsoft.Template\/uri\/https%3A%2F%2Fraw.githubusercontent.com%2Feaskerov%2Fvsts-agent-vm-weblogic%2Fmaster%2Fsrc%2FvstsBuildAgentWLSOELTemplate.json\"> <img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/deploybutton.png\" \/><\/a><\/p>\n<p>Then you will need to select your <strong>Subscription<\/strong>, <strong>Location<\/strong> to deploy, <strong>Resource Group<\/strong>, and supply an <strong>Admin Username<\/strong>, <strong>Password<\/strong>, and unique <strong>DNS name<\/strong> for the machine. The machine type will be a <strong>Standard D1_V2<\/strong>. You will also need to specify the <strong>VSTS Account Name<\/strong> to use and a <strong>Personal Access Token (PAT)<\/strong>. If you don\u2019t have a personal access token, follow <a href=\"https:\/\/www.visualstudio.com\/en-us\/docs\/setup-admin\/team-services\/use-personal-access-tokens-to-authenticate\">this link<\/a> to create one. Finally, you need to define <strong>VSTS Agent Pool Name<\/strong> (the one you\u2019ve created <em>on the previous step 1<\/em>) and VSTS Agent Name. The VM will be deployed to a <em>Resource Group <\/em>along with a virtual network and some other required resources. You can delete this resource group to remove all the created resources at any time. Please allow about 10 &#8211; 15 minutes to complete provisioning and configuration.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS2.png\"><img decoding=\"async\" width=\"709\" height=\"619\" class=\"wp-image-33085 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS2-1024x894.png\" \/><\/a><\/p>\n<p>Once deployment completed, you should see the following resources created in the <strong>Azure Portal<\/strong>:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS3.png\"><img decoding=\"async\" width=\"825\" height=\"493\" class=\" wp-image-33095 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS3-1024x612.png\" \/><\/a><\/p>\n<h3>Step 3<\/h3>\n<p>The VM provisioned on previous step includes the following components:<\/p>\n<ul>\n<li>VSTS Build Agent for Linux<\/li>\n<li>Oracle JDK 8u131<\/li>\n<li>Apache Maven 3.5.0<\/li>\n<li>Git 2.9.2<\/li>\n<\/ul>\n<p>Once the VM is provisioned, VSTS Build Agent service will be installed and run. You need to go to your Visual Studio Team Services console, navigate to <strong>Settings<\/strong> -&gt; <strong>Agent Pool<\/strong> tab, then click on the pool item, you\u2019ve created <em>during the step 1<\/em>. You should see that your VSTS agent is up and running now.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS4.png\"><img decoding=\"async\" width=\"781\" height=\"391\" class=\"wp-image-33096 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS4-1024x512.png\" \/><\/a><\/p>\n<h4>Step 4<\/h4>\n<p>It is time for the next step. Now we need to configure Apache Maven settings to add Oracle Maven Repository in our provisioned Azure VM. The Maven artifact xml requires additional configuration to support the Oracle Maven Repository. To do this you need to SSH to you VSTS agent VM using admin username and password, provided <i>on the step 2<\/i>. Using <a href=\"http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/latest.html\">Putty<\/a>, <a href=\"https:\/\/msdn.microsoft.com\/en-gb\/commandline\/wsl\/about\">Bash for Windows<\/a> or other Linux machine go the terminal end execute the following command:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #f8f8f8;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #19177c\">$ <\/span>ssh &lt;vsvm_admin_username&gt;@&lt;vsvm_public_ip&gt;\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>You can check the VSTS Agent VM public IP address in Azure portal. Alternatively, you can simply click <strong>Connect<\/strong> button at the top of VM info panel and system will generate full ssh command to connect:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS5.png\"><img decoding=\"async\" width=\"749\" height=\"266\" class=\"wp-image-33105 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS5-1024x364.png\" \/><\/a><\/p>\n<p>Now you will need to edit <strong>settings.xml<\/strong> artifact and add Oracle Maven Repository configuration to the <strong>&lt;servers&gt;<\/strong> section. \u00a0There are several locations where you can modify <strong>settings.xml<\/strong> artifact:<\/p>\n<ul>\n<li>Maven global conf folder: <strong>$MAVEN_HOME\/conf\/settings.xml<\/strong><\/li>\n<li>A user\u2019s local .m2 folder: <strong>$HOME\/.m2\/settings.xml<\/strong><\/li>\n<\/ul>\n<p>In our case, we will use global configuration <strong>settings.xml<\/strong> file located in Maven <strong>$MAVEN_HOME\/conf\/\u00a0 <\/strong>directory. For further details please check <a href=\"https:\/\/maven.apache.org\/settings.html\">Maven documentation<\/a>.<\/p>\n<p>Example of configuration code is provided below:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #062873;font-weight: bold\">&lt;settings&gt;<\/span>\n    ...\n <span style=\"color: #062873;font-weight: bold\">&lt;servers&gt;<\/span>\n    ...\n  <span style=\"color: #062873;font-weight: bold\">&lt;server&gt;<\/span>\n      <span style=\"color: #062873;font-weight: bold\">&lt;id&gt;<\/span>maven.oracle.com<span style=\"color: #062873;font-weight: bold\">&lt;\/id&gt;<\/span>\n      <span style=\"color: #062873;font-weight: bold\">&lt;username&gt;<\/span>OTN_USERNAME<span style=\"color: #062873;font-weight: bold\">&lt;\/username&gt;<\/span>\n      <span style=\"color: #062873;font-weight: bold\">&lt;password&gt;<\/span>OTN_PASSWORD<span style=\"color: #062873;font-weight: bold\">&lt;\/password&gt;<\/span>\n      <span style=\"color: #062873;font-weight: bold\">&lt;configuration&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;basicAuthScope&gt;<\/span>\n          <span style=\"color: #062873;font-weight: bold\">&lt;host&gt;<\/span>ANY<span style=\"color: #062873;font-weight: bold\">&lt;\/host&gt;<\/span>\n          <span style=\"color: #062873;font-weight: bold\">&lt;port&gt;<\/span>ANY<span style=\"color: #062873;font-weight: bold\">&lt;\/port&gt;<\/span>\n          <span style=\"color: #062873;font-weight: bold\">&lt;realm&gt;<\/span>OAM 11g<span style=\"color: #062873;font-weight: bold\">&lt;\/realm&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;\/basicAuthScope&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;httpConfiguration&gt;<\/span>\n          <span style=\"color: #062873;font-weight: bold\">&lt;all&gt;<\/span>\n            <span style=\"color: #062873;font-weight: bold\">&lt;params&gt;<\/span>\n              <span style=\"color: #062873;font-weight: bold\">&lt;property&gt;<\/span>\n                <span style=\"color: #062873;font-weight: bold\">&lt;name&gt;<\/span>http.protocol.allow-circular-redirects<span style=\"color: #062873;font-weight: bold\">&lt;\/name&gt;<\/span>\n                <span style=\"color: #062873;font-weight: bold\">&lt;value&gt;<\/span>%b,true<span style=\"color: #062873;font-weight: bold\">&lt;\/value&gt;<\/span>\n              <span style=\"color: #062873;font-weight: bold\">&lt;\/property&gt;<\/span>\n            <span style=\"color: #062873;font-weight: bold\">&lt;\/params&gt;<\/span>\n          <span style=\"color: #062873;font-weight: bold\">&lt;\/all&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;\/httpConfiguration&gt;<\/span>\n      <span style=\"color: #062873;font-weight: bold\">&lt;\/configuration&gt;<\/span>\n  <span style=\"color: #062873;font-weight: bold\">&lt;\/server&gt;<\/span>\n    ...\n <span style=\"color: #062873;font-weight: bold\">&lt;\/servers&gt;<\/span>\n    ...\n<span style=\"color: #062873;font-weight: bold\">&lt;\/settings&gt;<\/span>\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>You must define your Oracle OTN Account username and password using <strong>&lt;username&gt;<\/strong> and <strong>&lt;password&gt;<\/strong> entries.<\/p>\n<p><strong><u>Important note:<\/u><\/strong> <u>It is strongly recommended<\/u> to encrypt your password using the standard Maven encryption mechanisms. Please check <a href=\"http:\/\/maven.apache.org\/guides\/mini\/guide-encryption.html\">official Maven documentation<\/a> for further clarifications.<\/p>\n<h4>Step 5<\/h4>\n<p>Now your VSTS Build Agent VM configuration has been completed and we are ready to move to next step, where we will configure VSTS project for building and deployment. It is assumed that your VSTS project and GIT repository for your Java project already created, so I will not focus on this here. If it is not created, please check <a href=\"https:\/\/www.visualstudio.com\/en-us\/docs\/setup-admin\/team-services\/sign-up-for-visual-studio-team-services\">official VSTS documentation how to do that<\/a>.<\/p>\n<p>Now we need to modify configure the POM artifact of our Java Application project.<\/p>\n<p>First, you need to add repository definition to your POM project file:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #062873;font-weight: bold\">&lt;project&gt;<\/span>\n  ...\n    <span style=\"color: #062873;font-weight: bold\">&lt;repositories&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;repository&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;id&gt;<\/span>maven.oracle.com<span style=\"color: #062873;font-weight: bold\">&lt;\/id&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;releases&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;enabled&gt;<\/span>true<span style=\"color: #062873;font-weight: bold\">&lt;\/enabled&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;\/releases&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;snapshots&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;enabled&gt;<\/span>false<span style=\"color: #062873;font-weight: bold\">&lt;\/enabled&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;\/snapshots&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;url&gt;<\/span>https:\/\/maven.oracle.com<span style=\"color: #062873;font-weight: bold\">&lt;\/url&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;layout&gt;<\/span>default<span style=\"color: #062873;font-weight: bold\">&lt;\/layout&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;\/repository&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;\/repositories&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;pluginRepositories&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;pluginRepository&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;id&gt;<\/span>maven.oracle.com<span style=\"color: #062873;font-weight: bold\">&lt;\/id&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;url&gt;<\/span>https:\/\/maven.oracle.com<span style=\"color: #062873;font-weight: bold\">&lt;\/url&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;\/pluginRepository&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;\/pluginRepositories&gt;<\/span>\n  ...\n<span style=\"color: #062873;font-weight: bold\">&lt;\/project&gt;<\/span>\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>Next, you need to add WebLogic Maven Plugin configuration in <strong>&lt;plugins&gt;<\/strong> entry in your POM project file. In our case, we are using simple configuration to perform remote deployment with <a href=\"https:\/\/docs.oracle.com\/middleware\/1221\/wls\/WLPRG\/maven.htm#WLPRG620\">deploy<\/a> goal. However, as I\u2019ve mentioned earlier, plugin supports other functionality and more complex scenarios, where you are able not only to deploy your app, but start, stop WebLogic Server instances, create domain, execute WLST scripts and even install WebLogic Server binaries. For additional information please check <a href=\"https:\/\/docs.oracle.com\/middleware\/1221\/wls\/WLPRG\/maven.htm#WLPRG585\">WebLogic Maven Plugin official documentation<\/a>.<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #062873;font-weight: bold\">&lt;project&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;modelVersion&gt;<\/span>4.0.0<span style=\"color: #062873;font-weight: bold\">&lt;\/modelVersion&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;groupId&gt;<\/span>com.example.myapplication<span style=\"color: #062873;font-weight: bold\">&lt;\/groupId&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;artifactId&gt;<\/span>myapplication<span style=\"color: #062873;font-weight: bold\">&lt;\/artifactId&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;packaging&gt;<\/span>war<span style=\"color: #062873;font-weight: bold\">&lt;\/packaging&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;version&gt;<\/span>1.0-SNAPSHOT<span style=\"color: #062873;font-weight: bold\">&lt;\/version&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;name&gt;<\/span>myapplication Maven Webapp<span style=\"color: #062873;font-weight: bold\">&lt;\/name&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;url&gt;<\/span>http:\/\/maven.apache.org<span style=\"color: #062873;font-weight: bold\">&lt;\/url&gt;<\/span>\n    ...\n    <span style=\"color: #062873;font-weight: bold\">&lt;build&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;finalName&gt;<\/span>myapplication<span style=\"color: #062873;font-weight: bold\">&lt;\/finalName&gt;<\/span>\n        <span style=\"color: #062873;font-weight: bold\">&lt;plugins&gt;<\/span>\n            ...\n            <span style=\"color: #062873;font-weight: bold\">&lt;plugin&gt;<\/span>\n                <span style=\"color: #062873;font-weight: bold\">&lt;groupId&gt;<\/span>com.oracle.weblogic<span style=\"color: #062873;font-weight: bold\">&lt;\/groupId&gt;<\/span>\n                <span style=\"color: #062873;font-weight: bold\">&lt;artifactId&gt;<\/span>weblogic-maven-plugin<span style=\"color: #062873;font-weight: bold\">&lt;\/artifactId&gt;<\/span>\n                <span style=\"color: #062873;font-weight: bold\">&lt;version&gt;<\/span>12.2.1-2-0<span style=\"color: #062873;font-weight: bold\">&lt;\/version&gt;<\/span>\n                <span style=\"color: #062873;font-weight: bold\">&lt;configuration&gt;<\/span>\n                    <span style=\"color: #062873;font-weight: bold\">&lt;adminurl&gt;<\/span>t3:\/\/WLS_HOSTNAME:7001<span style=\"color: #062873;font-weight: bold\">&lt;\/adminurl&gt;<\/span>\n                    <span style=\"color: #062873;font-weight: bold\">&lt;user&gt;<\/span>${weblogic.username}<span style=\"color: #062873;font-weight: bold\">&lt;\/user&gt;<\/span>\n                    <span style=\"color: #062873;font-weight: bold\">&lt;password&gt;<\/span>${weblogic.password}<span style=\"color: #062873;font-weight: bold\">&lt;\/password&gt;<\/span>\n                    <span style=\"color: #062873;font-weight: bold\">&lt;upload&gt;<\/span>true<span style=\"color: #062873;font-weight: bold\">&lt;\/upload&gt;<\/span>\n                    <span style=\"color: #062873;font-weight: bold\">&lt;targets&gt;<\/span>AdminServer<span style=\"color: #062873;font-weight: bold\">&lt;\/targets&gt;<\/span>\n                    <span style=\"color: #062873;font-weight: bold\">&lt;remote&gt;<\/span>true<span style=\"color: #062873;font-weight: bold\">&lt;\/remote&gt;<\/span>\n                    <span style=\"color: #062873;font-weight: bold\">&lt;verbose&gt;<\/span>true<span style=\"color: #062873;font-weight: bold\">&lt;\/verbose&gt;<\/span>\n                    <span style=\"color: #062873;font-weight: bold\">&lt;source&gt;<\/span>${project.build.directory}\/${project.build.finalName}.${project.packaging}<span style=\"color: #062873;font-weight: bold\">&lt;\/source&gt;<\/span>\n                    <span style=\"color: #062873;font-weight: bold\">&lt;name&gt;<\/span>${project.build.finalName}<span style=\"color: #062873;font-weight: bold\">&lt;\/name&gt;<\/span>\n                <span style=\"color: #062873;font-weight: bold\">&lt;\/configuration&gt;<\/span>\n                <span style=\"color: #062873;font-weight: bold\">&lt;executions&gt;<\/span>\n                    <span style=\"color: #062873;font-weight: bold\">&lt;execution&gt;<\/span>\n                        <span style=\"color: #062873;font-weight: bold\">&lt;phase&gt;<\/span>install<span style=\"color: #062873;font-weight: bold\">&lt;\/phase&gt;<\/span>\n                        <span style=\"color: #062873;font-weight: bold\">&lt;goals&gt;<\/span>\n                            <span style=\"color: #062873;font-weight: bold\">&lt;goal&gt;<\/span>deploy<span style=\"color: #062873;font-weight: bold\">&lt;\/goal&gt;<\/span>\n                        <span style=\"color: #062873;font-weight: bold\">&lt;\/goals&gt;<\/span>\n                    <span style=\"color: #062873;font-weight: bold\">&lt;\/execution&gt;<\/span>\n                <span style=\"color: #062873;font-weight: bold\">&lt;\/executions&gt;<\/span>\n            <span style=\"color: #062873;font-weight: bold\">&lt;\/plugin&gt;<\/span>\n            ...\n        <span style=\"color: #062873;font-weight: bold\">&lt;\/plugins&gt;<\/span>\n    <span style=\"color: #062873;font-weight: bold\">&lt;\/build&gt;<\/span>\n<span style=\"color: #062873;font-weight: bold\">&lt;\/project&gt;<\/span>\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>Please note some important parameters related to WebLogic in configuration above:<\/p>\n<ul>\n<li><strong>&lt;version&gt;12.2.1-2-0&lt;\/version&gt;<\/strong> &#8211; WebLogic Maven Plugin version. In our case this is 2.1-2-0.<\/li>\n<li><strong>&lt;adminurl&gt;t3:\/\/WLS_HOSTNAME:7001&lt;\/adminurl&gt;<\/strong> &#8211; listen address and listen port of the Administration Server. Please note that in our case we are using default listen port is <strong>7001<\/strong>. However, in your domain configuration the port number could be different.<\/li>\n<li><strong>&lt;user&gt;${weblogic.username}&lt;\/user&gt; &lt;password&gt;${weblogic.password}&lt;\/password&gt;<\/strong> &#8211; WebLogic administrative username and password defined as environment variables.<\/li>\n<li><strong>&lt;remote&gt;true&lt;\/remote&gt;<\/strong> &#8211; indicating that plugin is not running on the same machine as Administration Server. This is exactly our case since we are going to perform remote deployment.<\/li>\n<li><strong>&lt;targets&gt;AdminServer&lt;\/targets&gt;<\/strong> &#8211; this parameter specifies a comma-separated list of targets for the current operation, in our case this is deployment to Admin Server target. Please note that Admin Server name could be different and depends on your WebLogic Domain configuration. For instance, if you are using WebLogic Quick Installer, Admin Server name could be <strong>myserver<\/strong> by default.<\/li>\n<\/ul>\n<h4>Step 6<\/h4>\n<p>Now we are ready to move to next step and create <strong>Build Definition<\/strong> in VSTS console. Go to your VSTS account homepage and browse (if necessary) your Java Application project. Once on the project\u2019s home page, click on the <strong>Build &amp; Release<\/strong> menu and then select <strong>Builds <\/strong>option.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS6.png\"><img decoding=\"async\" width=\"752\" height=\"230\" class=\"wp-image-33115 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS6-1024x313.png\" \/><\/a><\/p>\n<p>Click the <strong>+ New Definition<\/strong> button to create a new build definition.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS7.png\"><img decoding=\"async\" width=\"693\" height=\"294\" class=\"wp-image-33125 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS7-1024x434.png\" \/><\/a><\/p>\n<p>Select <strong>Empty<\/strong> template and click <strong>Apply<\/strong> button. There are a plenty of predefined templates are available for different kind of build definitions, but we are going to create custom one.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS8.png\"><img decoding=\"async\" width=\"879\" height=\"439\" class=\"size-large wp-image-33135 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS8-1024x511.png\" \/><\/a><\/p>\n<p>Go to the <strong>Tasks<\/strong> tab and click <strong>+ Add task <\/strong>button, then find and select <strong>Maven task<\/strong> item and finally click <strong>Add<\/strong> button to add it to the build definition.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS9.png\"><img decoding=\"async\" width=\"879\" height=\"376\" class=\"alignnone size-large wp-image-33145\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS9-1024x438.png\" \/><\/a><\/p>\n<p>Select just created <strong>Maven task<\/strong>. Now you need to define task properties:<\/p>\n<ul>\n<li>Set <strong>Display name<\/strong> as <strong>Maven Build and Deploy <\/strong>(or another name you like).<\/li>\n<li>Set <strong>Maven POM file<\/strong> You can either type or browse using the <strong>\u2026<\/strong> button.<\/li>\n<li>Define Maven goals in the <strong>Goal(s)<\/strong> field, in our case it will be <strong>clean install<\/strong>.<\/li>\n<li>In the <strong>Options<\/strong> field, you need to define WebLogic Admin username and password as the values of environmental variables (please define your correct WebLogic Admin username and password):<\/li>\n<\/ul>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\">-Dweblogic.username=weblogic -Dweblogic.password=welcome1\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS10.png\"><img decoding=\"async\" width=\"836\" height=\"495\" class=\"size-full wp-image-33155 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS10.png\" \/><\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS11.png\"><img decoding=\"async\" width=\"848\" height=\"383\" class=\" wp-image-33165 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS11-1024x462.png\" \/><\/a><\/p>\n<p>Navigate to the <strong>Triggers<\/strong> tab and switch on <strong>Continuous Integration (CI) <\/strong>option. Ensure that other settings like <strong>Branch Filters<\/strong> are set up correctly. Check <a href=\"https:\/\/www.visualstudio.com\/en-us\/docs\/build\/define\/triggers\"><strong>Batch changes while a build is in progress<\/strong><\/a> option if this is required in your case.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS12.png\"><img decoding=\"async\" width=\"879\" height=\"435\" class=\"size-large wp-image-33175 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS12-1024x507.png\" \/><\/a><\/p>\n<p>Go to <strong>Options<\/strong> tab and select <strong>Default agent queue<\/strong> to the one you have created and configured <em>on the step 1<\/em> (e.g. <strong>vsts-wls<\/strong>).<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS13.png\"><img decoding=\"async\" width=\"879\" height=\"430\" class=\"size-large wp-image-33185 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS13-1024x501.png\" \/><\/a><\/p>\n<p>Navigate back to <strong>Tasks<\/strong> tab, select <strong>Get Sources<\/strong> step and ensure that <strong>This Project<\/strong> is selected with appropriate <strong>Repository<\/strong> and <strong>Branch<\/strong>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS14.png\"><img decoding=\"async\" width=\"879\" height=\"431\" class=\"size-large wp-image-33186 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS14-1024x502.png\" \/><\/a><\/p>\n<p>Finally give a name for our build definition (i.e. \u00ab<strong>CI with WebLogic Server<\/strong>\u00bb), clicking to the build definition title, then click on <strong>Save &amp; queue<\/strong> dropdown list and select <strong>Save<\/strong> option to save our build definition. Accept default settings (or add your comment) and click <strong>Save<\/strong> button in the pop-up dialog window.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS15.png\"><img decoding=\"async\" width=\"879\" height=\"178\" class=\"size-large wp-image-33195 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS15-1024x207.png\" \/><\/a><\/p>\n<h4>Step 7<\/h4>\n<p>Now we are ready to start build and deploy process. Since we have enabled <strong>Continuous Integration (CI)<\/strong> trigger above, build and deploy process will start automatically once we push any new commit to our repository. Alternatively, to test our build definition we can queue new build manually. Click <strong>Queue new build\u2026<\/strong> button for just created build definition. Leave settings by default and then click <strong>OK<\/strong> button to start.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS16.png\"><img decoding=\"async\" width=\"717\" height=\"482\" class=\"wp-image-33205 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS16-1024x688.png\" \/><\/a><\/p>\n<p>This should trigger the build definition we have created. Click the <strong>Build<\/strong> tab to see the build process in action. Once complete, you should see build summary, which includes deployment results.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS17.png\"><img decoding=\"async\" width=\"879\" height=\"421\" class=\"size-large wp-image-33215 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS17-1024x490.png\" \/><\/a><\/p>\n<p>Please <strong>note<\/strong> that in our case since we are using WebLogic Domain in <strong>development mode<\/strong> we do not need to start our application <strong>explicitly<\/strong>, but if your WebLogic domain in production mode then you need to start your application using <a href=\"https:\/\/docs.oracle.com\/middleware\/1221\/wls\/WLPRG\/maven.htm#WLPRG650\">start-app<\/a> plugin goal.<\/p>\n<h4>Step 8<\/h4>\n<p>Finally go to your Oracle WebLogic Server Administration Console to ensure that your application is deployed and running successfully.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/WLSVSTS18.png\"><img decoding=\"async\" width=\"879\" height=\"387\" class=\"size-large wp-image-33225 aligncenter\" alt=\"\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/06\/WLSVSTS18-1024x451.png\" \/><\/a><\/p>\n<h2>Conclusion<\/h2>\n<p>In this article, we\u2019ve considered relatively simple case of Java Project CI\/CD with Oracle WebLogic Server, but flexibility of Microsoft Visual Studio Team Services Platform allows you to define much more complex CI\/CD pipelines with build and release definitions mechanism along with private Build Agents. \u00a0Find out more on <a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/\">Microsoft VSTS ALM blog<\/a> and <a href=\"https:\/\/www.visualstudio.com\/en-us\/docs\/overview\">official documentation<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are interested in Microsoft Visual Studio Team Services (VSTS) platform and Java development, maybe you know that VSTS has everything you need to organize CI\/CD pipeline for your Java application development. Visual Studio ALM Blog has a lot of useful and helpful resources describing how to build and deploy your Java application and [&hellip;]<\/p>\n","protected":false},"author":236,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[224,226,1,249],"tags":[],"class_list":["post-32886","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","category-ci","category-devops","category-open-source"],"acf":[],"blog_post_summary":"<p>If you are interested in Microsoft Visual Studio Team Services (VSTS) platform and Java development, maybe you know that VSTS has everything you need to organize CI\/CD pipeline for your Java application development. Visual Studio ALM Blog has a lot of useful and helpful resources describing how to build and deploy your Java application and [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/32886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/236"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=32886"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/32886\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=32886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=32886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=32886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}