MyBatis Generator access properties failed when ref over 2 levels

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

MyBatis Generator access properties failed when ref over 2 levels

Hodo Info
Hello everyone,
    I am running the MBG in maven Env. 
I have added a generator.properties and generatorConfig.xml to the project.
All things is ok, but when access the properties in the generator.properties file with the syntax ${xx.yy}  over 2 levels it failed.

my config files :
generator.properties
jdbc.url=jdbc:postgresql://47.75.181.0:5432/trans
jdbc.username=xcoin
jdbc.password=xc1807*#0
jdbc.driver-class.name=org.postgresql.Driver

gen.code.package=org.girllee.boot.dao
gen.code.domain=domain
gen.code.mapper=mapper
gen.code.subpackage=pg

generatorConfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
      PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
      "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>

   <properties resource="generator.properties"></properties>

   <context id="default" targetRuntime="MyBatis3">
      <property name="javaFileEncoding" value="UTF-8"/>
      <property name="autoDelimitKeywords" value="false"/>
      <property name="javaFormatter" value="org.mybatis.generator.api.dom.DefaultJavaFormatter"/>
      <property name="xmlFormatter" value="org.mybatis.generator.api.dom.DefaultXmlFormatter"/>
      <property name="beginningDelimiter" value="`"/>
      <property name="endingDelimiter" value="`"/>
     
      <commentGenerator>
         <property name="suppressDate" value="true"/>
         <property name="suppressAllComments" value="false"/>
         <property name="addRemarkComments" value="true"/>
      </commentGenerator>
     
      <jdbcConnection driverClass="${jdbc.driver-class.name}"
                      connectionURL="${jdbc.url}"
                      userId="${jdbc.username}" password="${jdbc.password}">
         <property name="useInformationSchema" value="true"/>
         <property name="remarks" value="true"/>
      </jdbcConnection>
     
      <javaTypeResolver>
         <property name="forceBigDecimals" value="false"/>
      </javaTypeResolver>
     
      <javaModelGenerator targetPackage="${gen.code.package}.${gen.code.domain}.pg" targetProject="src/main/java">
         <property name="enableSubPackages" value="true"/>
         <property name="trimStrings" value="true"/>
      </javaModelGenerator>

      <sqlMapGenerator targetPackage="${gen.code.package}.${gen.code.mapper}.pg" targetProject="src/main/java">
         <property name="enableSubPackages" value="true"/>
      </sqlMapGenerator>

      <javaClientGenerator type="XMLMAPPER" targetPackage="${gen.code.package}.${gen.code.mapper}.pg"
                      targetProject="src/main/java">
         <property name="enableSubPackages" value="true"/>
      </javaClientGenerator>

      <table catalog="public" tableName="test" domainObjectName="PgTx">
         <generatedKey column="id" sqlStatement="JDBC" identity="true"/>
      </table>
   </context>
</generatorConfiguration>

with these config files, MyBatis Generator runs in maven env perfect.

As you see I am set the targetPackage="${gen.code.package}.${gen.code.mapper}.pg"


But if set the targetPackage="${gen.code.package}.${gen.code.mapper}.${gen.code.subpackage}"

It raise an error looks like:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project boot: Compilation failure
[ERROR] /home/Asin Liu/Project/ray/boot/src/main/java/org/girllee/boot/dao/mapper/${gen/code/subpackage}/PgTxMapper.java:[1,38] ';' expected

Anyone can help me?

Best

Asin Liu



--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.