0 Replies Latest reply on Mar 27, 2017 4:43 PM by Hosup Chung

    Update datasource using maven with cli script

    Hosup Chung Newbie



      I'm using following cli script to create a datasource.


      if (outcome != success) of /subsystem=datasources/data-source=CompanyDS:read-resource

           /subsystem=datasources/data-source=CompanyDS:add( \

                jndi-name="java:jboss/datasources/CompanyDS", \

                use-ccm="true", \

                jta="true", \

                enabled="true", \

                driver-name="jtds-1.3.1.jar", \

                driver-class="net.sourceforge.jtds.jdbc.Driver", \

                connection-url="${company.db.connection-url}", \

                user-name="${company.db.username}", \




      company.db.* properties are defined in external property file. And content of the property file is preloaded in maven before executing cli script.


      We'll change database location soon, so I want to update the script to update the datasource somehow. So I added following code before above code to remove datasource first, and re-add it again.


      if (outcome == success) of /subsystem=datasources/data-source=CompanyDS:read-resource




      However, this didn't work, because once the datasource is removed, I can't re-add new datasource with same name until server configuration is reloaded.

      We are using maven, so we specify wildly:execute-commands goal in part of maven goals.


































      I'd like to how other people using maven update datasource using cli scripts.


      Thank you