Failing to import Component in Cuba Platform 6.3.2

When I try to import a component as described in the documentation i get following build error:


BUILD SUCCESSFUL  Total time: 11.379 secs [23:55:04.110] Create standard screens
[23:55:04.453] Created file modules\web\src\com\dirdalit\sales\web\saleorder\sale-order-browse.xml
[23:55:04.606] Created file modules\web\src\com\dirdalit\sales\web\saleorder\sale-order-edit.xml
[23:55:04.696] Created file modules\web\src\com\dirdalit\sales\web\saleorder\SaleOrderBrowse.java
[23:55:04.790] Created file modules\web\src\com\dirdalit\sales\web\saleorder\SaleOrderEdit.java
[23:55:04.819] File modules\web\src\com\dirdalit\sales\web\saleorder\sale-order-edit.xml registered as sales$SaleOrder.edit in modules\web\src\com\dirdalit\sales\web-screens.xml
[23:55:04.848] File modules\web\src\com\dirdalit\sales\web\saleorder\sale-order-browse.xml registered as sales$SaleOrder.browse in modules\web\src\com\dirdalit\sales\web-screens.xml
[23:55:04.931] Standard screens have been created successfully
[23:55:40.691] Creating database jdbc:hsqldb:hsql://localhost/sales
:app-core:assembleDbScripts 

FAILED  FAILURE: Build failed with an exception.  
* What went wrong: Execution failed for task ':app-core:assembleDbScripts'. > 
Could not find cust-core-db.jar (com.dirdalit.customers:cust-core:0.2).   
Searched in the following locations:       
file:/C:/Users/kjell/.m2/repository/com/dirdalit/customers/cust-core/0.2/cust-core-0.2-db.jar  
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.  

BUILD FAILED  Total time: 2.616 secs [23:55:43.520] Task 'createDb' failed
org.gradle.internal.resolve.ArtifactNotFoundException: 
Could not find cust-core-db.jar (com.dirdalit.customers:cust-core:0.2). 
Searched in the following locations:     
file:/C:/Users/kjell/.m2/repository/com/dirdalit/customers/cust-core/0.2/cust-core-0.2-db.jar

What is causing this?

I forgot to tell that i used Install App Component in the menu.

Does the file C:/Users/kjell/.m2/repository/com/dirdalit/customers/cust-core/0.2/cust-core-0.2-db.jar really exist?

If so, could you provide the app-component.xml file from inside .m2/repository/com/dirdalit/customers/cust-global/0.2/cust-global-0.2.jar?

No. The cust-core-db.jar does not exist.
It is not created when running Install App Component.
I have tried to change version, disabled snapshot, Cleaned, Assemble and checked sql script and then run Install App Component.

Same result cust-core-db.jar is not created.

This is what is in the folder when done install

Skjermbilde

In fact, such JAR is not needed. The DB scripts are built in the cust-core-0.2-db.zip. The question is, why you app requires this non-existent artifact?

Could you attach the app-component.xml file that I mentioned above?

Here is the App-Component descriptor.

app-component.zip (658B)

Strange. After I recreated the app-component file and ran the Install app component, everything worked as expected.

Here is what I discovered when i compared the old app-component descriptor and the new recreated app-descriptor:

The old one:


<module blocks="core"
            dependsOn="global"
            name="core">
        <artifact appJar="true"
                  name="cust-core"/>
        <property name="cuba.springContextConfig"
                  value="+com/dirdalit/customers/spring.xml"/>
        <property name="cuba.mainMessagePack"
                  value="+com.dirdalit.customers.core"/>
        <artifact classifier="db"
                  configuration="dbscripts"
                  name="cust-core"/>
    </module>

The new one:


<module blocks="core"
            dependsOn="global"
            name="core">
        <artifact appJar="true"
                  name="cust-core"/>
        <artifact classifier="db"
                  configuration="dbscripts"
                  ext="zip"
                  name="cust-core"/>
        <property name="cuba.springContextConfig"
                  value="+com/dirdalit/customers/spring.xml"/>
        <property name="cuba.mainMessagePack"
                  value="+com.dirdalit.customers.core"/>
    </module>

In the old one the artifact classifier=“db” is added after property name="cuba.springContextConfig"
In the new one artifact classifier=“db” is added before property name=“cuba.springContextConfig”

Could this be the cause of problem?

This is definitely the cause of the problem. The most important thing is that in the wrong app-component.xml, the dbscripts artifact element has no ext=“zip” attribute.

Would be great to find out the reason why the app-component.xml was generated incorrectly. At what moment did you create it? On what version of the platform and Studio? Were there any entities and DB schema in the project at that moment?

I can’t recreate the problem, but what I did was creating a new project based om Cuba Platform 6.3.2 -> Cuba Studio 6.3.0.

  1. Created entity Customer
  2. Created views customer.browse and customer.edit
  3. Created standard screen
  4. Ran create database
  5. checked that all updatescript has been ran
  6. Ran the project to see that all worked as expected on server
  7. Clean project
  8. Assemble project
  9. Created app component descriptor
  10. Ran Install app component v 1.0 Snapshot
  11. Closed Customer project

Later I tried

  1. Include the new component to Sale project.
  2. Ran clean then Assemble project
  3. Ran the sql update script after added customer to Sale entity.
  4. Tried to start the server. Resulting in error where the cust-core-db.jar file was not found.

Changed to Cuba Platform 6.3.0 and recreated the App component descriptor. Then it all ran as normal.

Hi.

We have reproduced the problem:

  1. If DB-scripts have not been created yet, generated component descriptor does not contain DB-artifact.
  2. When the DB-scripts are generated afterward, Studio adds the required strings to the XML but does it incorrectly.

If to press the “Re-create” button, app-component.xml is re-generated without the mistake.

Thank you for reporting the problem. We will fix it in the next Studio release.

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/STUDIO-3070