Torsten
Torsten

Reputation: 24184

wls-maven-plugin:deploy shared library

I've migrate from weblogic-maven-plugin (10.3) to wls-maven-plugin(12.1) and encountred problem with deploying shared library.

Problem is wls-maven-plugin don't pass to Weblogic.Deployer library flag. For weblogic-maven-plugin i have same conf:

<plugin> 
                <groupId>com.oracle.weblogic</groupId> 
                <artifactId>weblogic-maven-plugin</artifactId> 
                <version>10.3.6.0</version> 
                <configuration> 
                    <adminurl>t3://localhost:7001</adminurl>
                    <user>${weblogic.username}</user> 
                    <password>${weblogic.password}</password> 
                    <upload>true</upload>                                             
                    <source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>                                         
                    <name>${project.build.finalName}</name>
                    <isLibrary>true</isLibrary>
                </configuration>
</plugin>

There element isLibrary shows plugin to pass -library flag that invokes Weblogic.Deployer.

After migrate to wls plugin:

<plugin> 
                <groupId>com.oracle.weblogic</groupId> 
                <artifactId>wls-maven-plugin</artifactId> 
                <version>12.1.1.0</version> 
                <configuration> 
                    <adminurl>t3://localhost:7001</adminurl>
                    <user>${weblogic.username}</user> 
                    <password>${weblogic.password}</password> 
                    <middlewareHome>${env.MW_HOME}</middlewareHome>
                    <upload>false</upload> 
                    <action>deploy</action>                   
                    <remote>false</remote> 
                    <isLibrary>true</isLibrary>
                    <verbose>true</verbose>                         <source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source> 
                    <name>${project.build.finalName}</name> 
                </configuration>                   
</plugin> 

But wls plugin don't pass -library flag to Weblogic.Deployer and as result jar deployed with type unknown so my applications can't use library because don't found it.

Note: If i doing deploying manually with Weblogic.Deployer all works fine - so my manifest and weblogic-application.xml files should be correct.

Upvotes: 5

Views: 3170

Answers (4)

razvanone
razvanone

Reputation: 1459

Here are the steps to follow:

  • identify the oracle-maven-sync pom file and jar. Edit the pom file to your maven version. Install them: mvn -e install:install-file -DpomFile=oracle-maven-sync.12.1.2.pom -Dfile=oracle-maven-sync.12.1.2.jar

  • add to your repository the following dependencies:

    • jdom-1.1
    • maven-artifact
    • maven-compat
    • maven-plugin-api
    • commons-codec-1.6
    • commons-io-2.2
  • Create a folder on your local machine where you put the following Weblogic dependencies:

weblogic_dependencies
                     |
                     --wlserver
                               |
                               --server
                                       |
                                       --lib
                                            -- weblogic.jar
                     |
                     --modules

Copy the wlserver/server/lib/weblogic.jar and all the files under wlserver/modules folder from a weblogic installation). Set MW_HOME to point to the __weblogic_dependencies__ folder.

  • Run the following command from a machine where you have an installation of Weblogic: mvn -e -X -U com.oracle.maven:oracle-maven-sync:push -DserverId=archiva_repository_id_from_maven_config_xml -Doracle-maven-sync.oracleHome=%MW_HOME%

  • mvn -U archetype:crawl -Dcatalog=c:\.m2\archetype-catalog.xml

  • deploy on your artifacts repository the wls-maven-plugin (see Oracle documentation for that!).

  • Remote deploy without middlewareHome parameter (might not work): mvn clean package com.oracle.weblogic:wls-maven-plugin:deploy -Dadminurl=t3://admin_server_ip:7001 -Duser=weblogic_user -Dpassword=weblogic_pass -Dtargets=SRV_7011 -Dupload=true -Dname=maven_project_id

  • Remote deploy using the -DmiddlewareHome=%MW_HOME% parameter: mvn clean package com.oracle.weblogic:wls-maven-plugin:deploy -Dadminurl=t3://admin_server_ip:7001 -Duser=weblogic_user -Dpassword=weblogic_pass -Dtargets=SRV_7011 -Dupload=true -Dname=maven_project_id -Dverbose=true -DmiddlewareHome=%MW_HOME%

Upvotes: 0

Theodore
Theodore

Reputation: 192

IMHO it's more simple than the provided answers.

By looking closely the Oracle Documentation Page you can see that there is a configuration option library which states that: Deploy as a shared Java EE library or optional package.

This setting also needs the artifactLocation option.

The code below works smoothly and deploys the CommonLibs module as a library:

<build>
            <finalName>CommonLibs</finalName>
            <plugins>
                <plugin>
                    <groupId>com.oracle.weblogic</groupId>
                    <artifactId>weblogic-maven-plugin</artifactId>
                    <version>12.2.1.3</version>
                    <configuration>
                        <user>USER_NAME</user>
                        <password>PASS_WORD</password>
                        <name>${project.build.finalName}</name>
                        <source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
                        <artifactLocation>${project.build.directory}/${project.build.finalName}.${project.packaging}</artifactLocation>
                        <library>true</library>
                    </configuration>
                    <executions>
                        <execution>
                            <id>up</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>deploy</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>

Upvotes: 0

user3377322
user3377322

Reputation: 3

in maven plugin there is no "isLibrary" true tag to deploy as library

Upvotes: 0

Torsten
Torsten

Reputation: 24184

Workaround is wls:wlst. Call own wlst script (should be write by self - it simple) and pass parameters from maven such deployment source, url, user/password (using WLST command deploy we can pass is library parameter). It's work's well but looks bad at my point of view. Also, i think it could be done using ant task and call weblogic.deployer (anyway maven plugin and wlst call weblogic deployer application - it's just are wrappers).

Upvotes: 0

Related Questions