Maybe I'll blog this because it didn't work when I tried it as exploded (deployed directly from the IDE), but it did once I tried an EAR outside of the IDE (OEPE in this case).
Thanks to Edmond for helpful clues on this:
http://biemond.blogspot.com/2009/04/using-weblogic-deployment-plan-to.html
First export the EAR to a directory
Then go to your domain's bin dir with a shell and call setDomainEnv
Then call a command like this from the dir where the EAR is with that same shell:
java weblogic.PlanGenerator -all -plan Plan.xml PlanEAR.ear
That should generate a Plan.xml file.
The original weblogic.xml actually had the name of the context root explicitly defined for me like this:
<wls:context-root>PlanWEB</wls:context-root>
So firstly, we have to set the variable assignment in Plan.xml, where "FooPlan" is the value I want for my new context root.
Original:
<variable>
<name>WeblogicWebApp_ContextRoots_12482790756401</name>
<value xsi:nil="true"></value>
</variable>
New:
<variable>
<name>WeblogicWebApp_ContextRoots_12482790756401</name>
<value>FooPlan</value>
</variable>
So in order to override the context root we need to do a replace instead of a variable assignment since the element already exists. Edit Plan.xml again.
Original:
<variable-assignment>
<name>WeblogicWebApp_ContextRoots_12482790756401</name>
<xpath>/weblogic-web-app/context-root</xpath>
</variable-assignment>
New:
<variable-assignment>
<name>WeblogicWebApp_ContextRoots_12482790756401</name>
<xpath>/weblogic-web-app/context-root</xpath>
<operation>replace</operation>
</variable-assignment>
Now we can do a redeployment with this new deployment plan provided the EAR and Plan.xml and I can now access the application at
http://locahost:7001/FooPlan/.
java weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password welcome1 -redeploy -name PlanEAR -source PlanEAR.ear -targets AdminServer -plan Plan.xml