4

I'm mavenizing an ANT project and building the POM file. The current ANT build file has a target that generates 2 EAR files using weblogic's JwscTask. Now I just have to deploy only these 2 EAR files to a remote repo's weblogic server. I do not want Maven to generate any package, but take the generated 2 EAR files and deploy it. Essentially, the clean, compile and deploy phases have to be taken care of by Maven; packaging is done by ANT. I use the maven-antrun-plugin in the pom file to call the target in the build.xml file.

If I choose the packaging as 'POM', then Maven will not generate any packaging, but it won't compile the src files as well.

Is there any way in which I can skip the package phase in the Maven lifecycle? Say I specify the packaging as WAR in the POM, is there a way to skip the generation of the WAR file, and deploy the 2 EAR files?

Here is a section of the POM file:

<build>
  <plugins>
   <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-antrun-plugin</artifactId>
     <version>1.3</version>
     <executions>
      <execution>
        <phase>package</phase>
        <configuration>
        <tasks>
            <ant antfile="${basedir}/build.xml" target="build-service"/>
        </tasks>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
     </executions>
   </plugin>
  </plugins>
</build>
Tunaki
  • 132,869
  • 46
  • 340
  • 423
codewarrior
  • 984
  • 4
  • 18
  • 34

1 Answers1

3

Use the mvn deploy:deploy-file goal. This allows you to deploy a file into a repository without having to do the rest of the project in Maven. You can give it either a pom.xml to deploy with it, or specify the various parameters:

$ mvn deploy:deploy-file -Dfile=app.ear \
    -DpomFile=pom.xml \
    -DrepositoryId=VeggieCorp \
    -Durl=http://mvn.veggiecorp.com/releases

Or

$ mvn deploy:deploy-file -Dfile=app.ear \
    -DgroupId=com.veggicorp \
    -DartifactId=app \
    -Dversion=3.2.1 \
    -DrepositoryId=VeggieCorp \
    -Durl=http://mvn.veggiecorp.com/releases

In fact, you don't even need the -DrepositoryId parameter unless you've created a settings.xml because the repository requires a username and password or need a proxy.

David W.
  • 105,218
  • 39
  • 216
  • 337
  • I believe OP is asking for deploying to weblogic instead of deploying an artifact to a remote maven repo. – Adrian Shum Aug 23 '12 at 04:13
  • @David: Thanks, but I'm looking for how to skip the package phase in maven through the POM. – codewarrior Aug 23 '12 at 14:55
  • 1
    @rsriram7 - I see that now. It's what you get when you answer questions in the early morning. My confusion comes from the fact there's no _install this package to my server_ goal. You can see the [default lifecycles](http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html). Basically, after the package phase, you do _install_ onto the local Maven repository and _deploy_ onto a remote Maven repository. Are you using some sort of Weblogic deploy plugin? You can configure the pluginManager to [disable the phase](http://stackoverflow.com/q/2188746/368630) – David W. Aug 23 '12 at 21:42