Build failed with an exception

Hello

I found this error. while generate the new module.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‹ :generateCode ›.

Invalid namespace: com.axelor.apps.base.db.Address != com.axelor.contact.db.Address

share more on code of module,

on this path src/build/resources I added domains package and add 3 entity which is below
1)address.xml

    <?xml version="1.0" encoding="UTF-8"?>
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://axelor.com/xml/ns/domain-models
  http://axelor.com/xml/ns/domain-models/domain-models_5.4.xsd">
  <module name="contact" package="com.axelor.contact.db" />
  <entity name="Address" cacheable="true">
    <many-to-one name="contact" ref="Contact" required="true" />
    <string name="street" required="true" max="255" />
    <string name="area" max="255" />
    <string name="city" />
    <string name="zip" />
    <string name="state" />
    <string name="country" />
  </entity>
</domain-models>
  1. Contact.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://axelor.com/xml/ns/object-views
  http://axelor.com/xml/ns/object-views/object-views_5.4.xsd">

  <menuitem name="menu-contact-book" title="Address Book" />

  <menuitem name="menu-contact-friends" parent="menu-contact-book" title="All Contact" action="contact.all"/>

  <action-view name="contact.all" title="Contacts" model="com.axelor.contact.db.Contact">
    <view type="grid" name="contact-grid"/>
    <view type="form" name="contact-form"/>
  </action-view>

</object-views>
  1. Title.xml
<?xml version="1.0" encoding="UTF-8"?>
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.4.xsd">
  <module name="contact" package="com.axelor.contact.db"/>
  <entity name="Title">
    <string name="code" required="true" unique="true" min="2" />
    <string name="name" required="true" unique="true" min="2" />
  </entity>
</domain-models>

after geterate the code using code. « ./gradlew generateCode »

and then added the views package on same path. (src/main/resources). and added 2 files which is below

  1. contract.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://axelor.com/xml/ns/object-views
  http://axelor.com/xml/ns/object-views/object-views_5.4.xsd">

  <grid name="contact-grid" title="Contacts"
    model="com.axelor.contact.db.Contact">
    <field name="fullName" />
    <field name="email" />
    <field name="phone" />
    <field name="dateOfBirth" />
  </grid>

  <form name="contact-form" title="Contact"
    model="com.axelor.contact.db.Contact">
    <panel title="Overview">
      <field name="fullName" readonly="false">
        <editor>
          <field name="title" colSpan="3"/>
          <field name="firstName" colSpan="4"/>
          <field name="lastName" colSpan="5"/>
        </editor>
      </field>
      <field name="dateOfBirth" />
      <field name="email">
        <viewer><![CDATA[
        <a href="mailto:{{record.email}}">{{record.email}}</a>
        ]]></viewer>
      </field>
      <field name="phone">
        <viewer><![CDATA[
        <a href="tel:{{record.phone}}">{{record.phone}}</a>
        ]]></viewer>
      </field>
    </panel>
    <panel title="About me">
        <field name="notes" showTitle="false" colSpan="12"/>
    </panel>
    <panel-related field="addresses"
      form-view="address-form-popup">
        <field name="street"/>
        <field name="area"/>
        <field name="city"/>
        <field name="state"/>
        <field name="zip"/>
        <field name="country"/>
    </panel-related>
    <panel sidebar="true">
      <field name="createdOn"/>
      <field name="createdBy"/>
      <field name="updatedOn"/>
      <field name="updatedBy"/>
    </panel>
  </form>

  <form name="address-form-popup" title="Address"
    model="com.axelor.contact.db.Address">
    <panel title="Overview">
      <field name="street" />
      <field name="area" />
      <field name="city" />
      <field name="zip" />
      <field name="state" />
      <field name="country" />
    </panel>
  </form>

</object-views>
  1. Menu.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://axelor.com/xml/ns/object-views
  http://axelor.com/xml/ns/object-views/object-views_5.4.xsd">

  <menuitem name="menu-contact-book" title="Address Book" />

  <menuitem name="menu-contact-friends" parent="menu-contact-book" title="All Contact" action="contact.all"/>

  <action-view name="contact.all" title="Contacts" model="com.axelor.contact.db.Contact">
    <view type="grid" name="contact-grid"/>
    <view type="form" name="contact-form"/>
  </action-view>

</object-views>

again I build the code at that time I get the error. which I mention above.
and on database side my entity table also work.

better use different namespace
2nd use full model with package on ref columns

1 J'aime

can you please describe because I change the namespace then also build failed error comes

please share domain file i can comment better

I have got a near-identical error, like this :

Invalid namespace: com.axelor.apps.contract.db.Contract != com.axelor.apps.hire.db.Contract

when I added a new « hire » module (the build was OK after that), and then tried to add a new « Contract » domain (the error came up in the build following that). Does anyone know what the error means, and what to do about it?