title: Redeploy existing Nexus artifact to Weblogic
body: <p>I have a Hudson build job that builds a Maven project, and redeploys the resulting artifact to Nexus and to a remote Weblogic instance for testing.  I'm trying to create a separate job that would deploy the same artifact to another Weblogic instance, but to do so without recompiling the project and making a new WAR.  The rationale here is, the bits already exist and were tested in the development environment, and only if that passes can they be promoted to the development-integration environment.  Is this possible?</p>
  
  <p>So far, I have tried:
  1) using the existing POM and on the command line and declaring mvn deploy wls:undeploy wls:deploy  - This deploys the project WAR to the new environment but also builds the project from scratch.  The deploy goal also replaces the previously built project artifact (a snapshot) in Nexus, which makes sense.</p>
  
  <p>2) Tried creating a new POM where the artifact from the previous build is a dependency, and the wls-maven-plugin is the only plugin declared.  Running mvn wls:deploy  here also fails, for different reasons.</p>
  
  <p>Is there a way to perform such a deployment in a concise manner that I'm missing?  Am I using the wrong mechanism (Maven) for this?  Should I be using a more procedure based language like Ant?  Any insight would be greatly appreciated.  (Also if more information is required, please let me know!)</p>
  
  <p>Edit:  The redeployment succeeds if the built artifact is locally available in the target directory, and that location is referenced by the  properties file.  According to the documentation <a href="http://docs.oracle.com/cd/E24329_01/web.1211/e24368/maven.htm#CHEIJJHD" rel="nofollow">on Oracle's website</a> that parameter can either be local or GAV coordinates.  If I use GAV coordinates to pull the artifact directly from Nexus and then push it out to the remote Weblogic, I get the following Maven error:</p>
  
  <p><code>[INFO] Scanning for projects...
  [INFO]
  [INFO] ------------------------------------------------------------------------
  [INFO] Building MyWebApp 0.1-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO]
  [INFO] --- wls-maven-plugin:12.1.1.0:redeploy (default-cli) @ MyWebApp-deploy-DIT ---
  [INFO] ++====================================================================++
  [INFO] ++  wls-maven-plugin: redeploy                                        ++
  [INFO] ++====================================================================++
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 0.480s
  [INFO] Finished at: Wed Mar 20 10:19:22 EDT 2013
  [INFO] Final Memory: 4M/122M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal com.oracle.weblogic:wls-maven-plugin:12.1.1.0:redeploy (default-cli) on project MyWebApp-deploy-DIT: Invalid file. Please provide an existing fully qualified path of the file. -&gt; [Help 1]
  [ERROR]
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR]
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException</code></p>
  
  <p>For completeness, I'm also posting the POM I'm using to perform option #2:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;name&gt;MyWebApp&lt;/name&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.myorg.maven&lt;/groupId&gt;
          &lt;artifactId&gt;MyOrg-Parent&lt;/artifactId&gt;
          &lt;version&gt;2.0&lt;/version&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;org.myorg.apps&lt;/groupId&gt;
      &lt;artifactId&gt;MyWebApp-deploy-DIT&lt;/artifactId&gt;
      &lt;version&gt;0.1-SNAPSHOT&lt;/version&gt;
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;drools.version&gt;5.4.0.Final&lt;/drools.version&gt;
          &lt;REGION&gt;DEV&lt;/REGION&gt;
          &lt;MyWebApp_LOGDIR&gt;.&lt;/MyWebApp_LOGDIR&gt;
          &lt;webapp.jsp.dir&gt;src/main/webapp/WEB-INF/jsp&lt;/webapp.jsp.dir&gt;
          &lt;buildMsgJsp&gt;buildMsg.jsp&lt;/buildMsgJsp&gt;
          &lt;DEPLOYMENT_NAME&gt;MyWebApp&lt;/DEPLOYMENT_NAME&gt;
          &lt;MIDDLEWARE_HOME&gt;/ci/oracle/middleware&lt;/MIDDLEWARE_HOME&gt;
          &lt;WLS_ADMIN_HOST&gt;lncibd008&lt;/WLS_ADMIN_HOST&gt;
          &lt;WLS_PORT&gt;7001&lt;/WLS_PORT&gt;
          &lt;STAGE&gt;true&lt;/STAGE&gt;
          &lt;!--&lt;SOURCE&gt;${project.build.directory}/MyWebApp-3.7-SNAPSHOT.war&lt;/SOURCE&gt;--&gt;
          &lt;SOURCE&gt;org.myorg.apps:MyWebApp:war:3.7-SNAPSHOT&lt;/SOURCE&gt;
          &lt;WLS_TARGETS&gt;server1&lt;/WLS_TARGETS&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.myorg.apps&lt;/groupId&gt;
              &lt;artifactId&gt;MyWebApp&lt;/artifactId&gt;
              &lt;version&gt;3.7-SNAPSHOT&lt;/version&gt;
              &lt;type&gt;war&lt;/type&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;plugins&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;com.oracle.weblogic&lt;/groupId&gt;
                  &lt;artifactId&gt;wls-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;12.1.1.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;weblogicHome&gt;wlserver_12.1&lt;/weblogicHome&gt;
                      &lt;upload&gt;true&lt;/upload&gt;
                      &lt;remote&gt;true&lt;/remote&gt;
                      &lt;stage&gt;${STAGE}&lt;/stage&gt;
                      &lt;verbose&gt;true&lt;/verbose&gt;
                      &lt;userConfigFile&gt;wlsconfig/${WLS_ADMIN_HOST}${WLS_PORT}.config&lt;/userConfigFile&gt;
                      &lt;userKeyFile&gt;wlsconfig/${WLS_ADMIN_HOST}${WLS_PORT}.key&lt;/userKeyFile&gt;
                      &lt;adminurl&gt;http://${WLS_ADMIN_HOST}:${WLS_PORT}&lt;/adminurl&gt;
                      &lt;targets&gt;${WLS_TARGETS}&lt;/targets&gt;
                      &lt;source&gt;${SOURCE}&lt;/source&gt;--&gt;
                      &lt;name&gt;${DEPLOYMENT_NAME}&lt;/name&gt;
                      &lt;middlewareHome&gt;C:\Oracle\Middleware&lt;/middlewareHome&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>As you can see I have a commented-out  and a GAV .  Local one succeeds, GAV fails with the above error.  </p>