The next step in this Maven tutorial is to deploy to a Weblogic Server from Maven. To make this work you need to have a Maven Repository, where you can upload the required weblogic jars. In this blogpost I use Artifactory of JFrog. Download the standalone zip and start the Maven repository.
I don't want to upload a lot of Weblogic jars to this repository, so I will generate a Weblogic FullClient jar and use this instead.
Go to the wlserver_10.3\server\lib folder and start java -jar wljarbuilder.jar this will generate a new jar called wlfullclient.jar
Go to the artifactory Web Application, in my case http://localhost:8081/artifactory/webapp/home.html where you need to log in to upload the new jars. Use admin / password as username and password.
In the Deploy Tab you can upload this wlfullclient.jar
Change GroupId & ArtifactId to weblogic and version to 10.3.3
Do the same for the webservices.jar also located in wlserver_10.3\server\lib. Change GroupId to weblogic and version to 10.3.3
When you take a look at the Repository Browser you need to see this.
The next step is to configure the Maven settings.xml Here you need to add a server configuration, a development profile and make this profile active.
The server entry is needed to successful upload your project snapshot to the repository ( distributionManagement in the project pom) and the dev profile is used for the Development Weblogic Server properties and to define the Maven repositories.
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <servers> <server> <id>LAPTOPEDWIN</id> <username>admin</username> <password>password</password> </server> </servers> <profiles> <profile> <id>dev</id> <properties> <weblogic.version>10.3.3</weblogic.version> <wls.adminServerHostName>laptopedwin</wls.adminServerHostName> <wls.adminServerPort>7101</wls.adminServerPort> <wls.userId>weblogic</wls.userId> <wls.password>weblogic1</wls.password> </properties> <repositories> <repository> <id>central</id> <url>http://localhost:8081/artifactory/repo</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>snapshots</id> <url>http://localhost:8081/artifactory/repo</url> <releases> <enabled>false</enabled> </releases> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://localhost:8081/artifactory/repo</url> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> <pluginRepository> <id>snapshots</id> <url>http://localhost:8081/artifactory/repo</url> <releases> <enabled>true</enabled> </releases> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles> </settingsThe project pom with the weblogic-maven-plugin. This plugin uses the weblogic properties of the dev profile and has the two weblogic jars as dependency. For deploy you need to configure distributionManagement, Maven will upload the snapshot to the artifactory repository.
<?xml version="1.0" encoding="windows-1252" ?> <project xmlns="http://maven.apache.org/POM/4.0.0"> <modelVersion>4.0.0</modelVersion> <groupId>nl.whitehorses.maven</groupId> <artifactId>test.jpr</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <build> <plugins> <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>test</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>true</verbose> <debug>true</debug> <targetNames>DefaultServer</targetNames> <noExit>true</noExit> </configuration> <dependencies> <dependency> <groupId>weblogic</groupId> <artifactId>weblogic</artifactId> <version>10.3.3</version> <scope>provided</scope> </dependency> <dependency> <groupId>weblogic</groupId> <artifactId>webservices</artifactId> <version>10.3.3</version> <scope>provided</scope> </dependency> </dependencies> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1-alpha-2</version> <configuration> <webappDirectory>public_html/</webappDirectory> </configuration> </plugin> </plugins> </build> <distributionManagement> <repository> <id>LAPTOPEDWIN</id> <name>LAPTOPEDWIN-releases</name> <url>http://localhost:8081/artifactory/ext-releases-local</url> </repository> <snapshotRepository> <id>LAPTOPEDWIN</id> <name>LAPTOPEDWIN-snapshots</name> <url>http://localhost:8081/artifactory/ext-snapshots-local</url> </snapshotRepository> </distributionManagement> </project>Now you can use mvn deploy and this will deploy your project to the Weblogic Application server. ( when it fails on Windows with a strange Mbean error then this can be caused by, you are using a space in the local repository path ).
link to the Jdeveloper maven plugin does nt seem to working. Takes us to the oracle JDeveloper home page.
ReplyDeleteHi,
ReplyDeletehere is the right link
http://www.oracle.com/technetwork/developer-tools/jdev/maven11g-090173.html
thanks