Friday 4 May 2012

Webcenter automated deployment using ant

Problem
Webcenter automated deployment is not compatible yet with ojdeploy.

So it will be necessary to use WLST deploy. For that we can use an ant script to call a wlst script file (py) to prepare the mds application
(http://download.oracle.com/docs/cd/E17904_01/webcenter.1111/e12405/wcadm_deploy.htm#BABCCBEB)

Solution

1. Create a deploy.py file as below:


adminUser=sys.argv[6]
adminPassword=sys.argv[7]
adminUrl=sys.argv[8]
connect(adminUser,adminPassword,adminUrl)
domainRuntime()


def deployAll():
     print 'TESTING!'
     archive = getMDSArchiveConfig(='C:/wcportal-1.0.ear')
     archive.setAppMetadataRepository(repository=sys.argv[2],partition=sys.argv[3],type=sys.argv[4],
     jndi=sys.argv[5])
    archive.save()


# Deploy script init
     try:
     deployAll()


except:
    print "Unexpected error: ", sys.exc_info()[0]
    dumpStack()
    raise


2. Change the build.xml file as below:


<target name="deploy" description="deploy" >
<exec executable="${ofm.home}/oracle_common/common/bin/wlst.sh" spawn="false" failonerror="true">
<arg value="/refresh/oracle/testcases/ant_test/deploy.py"/>
<arg value="${earlocation}"/>
<arg value="${wc.mds.repository}"/>
<arg value="${project.build.finalName}"/>
<arg value="${wc.mds.repository.type}"/>
<arg value="${wc.mds.repository.jndi}"/>
<arg value="${wls.username}"/>
<arg value="${wls.password}"/>
<arg value="${wls.server}"/>
</exec>
</target>

No comments:

Post a Comment