我正在使用 maven 构建一个部署 WebLogic Server 10.3 的 EAR。棘手的部分是:
- 查找 weblogic-maven-plugin 的所有依赖项
- 将所有依赖项放在 maven repo 中(我真的推荐Sonatype Nexus)
- 将 noExit 设置为 true (否则你会在 hudson 遇到问题!)
我在 EAR 项目中使用以下目录结构:
pom.xml
src/
main/
app/
META-INF/
weblogic-application.xml
以下内容来自我的 pom.xml:
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<displayName>My Project</displayName>
<earSourceDirectory>src/main/app</earSourceDirectory>
<modules>
<webModule>
<groupId>com.somecompany</groupId>
<artifactId>webapp</artifactId>
</webModule>
</modules>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
<goal>start</goal>
</goals>
</execution>
</executions>
<configuration>
<name>my-project</name>
<adminServerHostName>${wls.adminServerHostName}</adminServerHostName>
<adminServerPort>${wls.adminServerPort}</adminServerPort>
<adminServerProtocol>t3</adminServerProtocol>
<userId>${wls.userId}</userId>
<password>${wls.password}</password>
<upload>true</upload>
<remote>true</remote>
<verbose>false</verbose>
<debug>false</debug>
<targetNames>AdminServer</targetNames>
<noExit>true</noExit>
</configuration>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>weblogic</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>webservices</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.utils.full</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.i18n</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.weblogic.rmi.client</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>javax.enterprise.deploy</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>webserviceclient</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.weblogic.security.wls</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.weblogic.security.identity</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.weblogic.security</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>wlclient</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.transaction</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.utils.classloaders</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>wljmsclient</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.management.core</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>wls-api</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.descriptor</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.logging</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.weblogic.socket.api</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.weblogic.security.digest</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.weblogic.workmanager</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.weblogic.lifecycle</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.utils.wrapper</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>wlsafclient</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.management.jmx</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>com.bea.core.descriptor.wl</artifactId>
<version>${weblogic.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>