Migrates the application context XML files from a Broadleaf 5.1 project to use the required 5.2 configuration
This project can either be cloned locally or the executable jar can be downloaded here
Locate the JAR in your local system and run
java -jar broadleaf-xml-migrator-{version}.jar --filepath={filepath} --qualifier={qualifier} --dryrun={true|false} --outputpath={dirpath}
Create the JAR by navigating to the root directory of where the repo was cloned and run
mvn package
The JAR will be built inside the target
directory so navigate there and run the command mentioned for the "Using Downloaded JAR" section
Naviagte to the root directory of where the repo was cloned and run
mvn spring-boot:run -Drun.arguments="--filepath={filepath},--qualifier={qualifier},--dryrun={true|false},--outputpath={dirpath}"
--filepath={filepath}
- Required
- The file or directory where the application contexts reside that need migrating. If it's a path to a file then that file will be used. If it's a folder then the application will recursively go through all of the sub directories and run the migration on every file that starts with
applicationContext
and ends withxml
. - If you are upgrading an entire project set this to the path to the root of your project
- This is important because the application deals with collisions and will prevent your application from declaring multiple beans with the same id
- Alternatively you can run the application multiple times for one project but make sure you change the qualifier argument for every run.
--qualifier={qualifier}
-
Optional
-
Defaults to
client
-
This is the custom text that should be added to bean ids in order to keep them unique from a broadleaf bean id. For example if in your project you added a custom activity to the CheckoutWorkflow like below
<bean id="blCheckoutWorkflow" class="org.broadleafcommerce.core.workflow.SequenceProcessor"> <property name="activities"> <list> <!-- This activity should occur at the very end of the checkout workflow, after everything has been executed --> <bean p:order="9999999" class="com.mycompany.workflow.checkout.SendOrderConfirmationEmailActivity" /> </list> </property> </bean>
Then the result would be
<bean id="blCheckoutWorkflowActivities-client" class="org.springframework.beans.factory.config.ListFactoryBean"> <property name="sourceList"> <list> <bean class="com.mycompany.workflow.checkout.SendOrderConfirmationEmailActivity" p:order="9999999"/> </list> </property> </bean> <bean class="org.broadleafcommerce.common.extensibility.context.merge.LateStageMergeBeanPostProcessor"> <property name="sourceRef" value="blCheckoutWorkflowActivities-client"/> <property name="targetRef" value="blCheckoutWorkflowActivities"/> </bean>
where
client
in the idblCheckoutWorkflowActivities-client
is the qualifier -
In the event that multiple declarations exist (for example it's common to add to
blMergedPersistenceXmlLocations
multiple times in one project) a- {number}
will be added to the end of the bean id in order to prevent that application from having declarations of beans with the same name.- For example if multiple applicationContexts were adding activities to the
blCheckoutWorkflow
then the second time it was found the resulting id of the collection bean would beblCheckoutWorkflowActivities-client-1
.
- For example if multiple applicationContexts were adding activities to the
-
--dryrun={true|false}
- Optional
- Defaults to false
- If set to true then the resulting migrated xml file prints to the console. If not set or not true then the file that was being migrated will be altered in place
--outputpath={path}
- Optional
- Defaults to nothing and is not used if it's not set
= If this parameter is set with a value then the resulting migrated xml file(s) will be saved to that location. The original xml files will be unchanged and will not be printed to the console. If this value is set and
--dryrun
is also set, the--dryrun
argument will be ignored
mvn package;java -jar target/broadleaf-xml-migrator-0.0.1-SNAPSHOT.jar --filepath=/Users/user/blc/DemoSite --dryrun=true --qualifier=ds
or
mvn package;java -jar target/broadleaf-xml-migrator-0.0.1-SNAPSHOT.jar --filepath=/Users/user/blc/DemoSite --outputpath=/users/user/blc/MigratedXml
mvn spring-boot:run -Drun.arguments="--filepath=/Users/user/blc/DemoSite,--qualifier=ds,--dryrun=true"
of
mvn spring-boot:run -Drun.arguments="--filepath=/Users/user/blc/DemoSite,--qualifier=ds,--outputpath=/users/user/blc/MigratedXml"
The result of running
mvn spring-boot:run -Drun.arguments="--filepath=src/main/resources/applicationContext-before.xml"
can be found here.
Note The file was originally changed in place but an original copy was retained for comparison and was named applicationContext-before