Uploaded image for project: 'Nuxeo ECM Build/Test Environment'
  1. Nuxeo ECM Build/Test Environment
  2. NXBT-2888

Nuxeo CLI command 'nuxeo studio export' erases existing operation(s) already exported to the Studio project

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Feature Candidate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Nuxeo CLI

      Description

      When executing Nuxeo CLI command nuxeo studio export to export the automation operation(s) to a Studio project, the operation(s) already defined in the Studio projects get(s) erased.

      A simple way to reproduce this is to:

      • create a bundle with an automation operation and export it to a Studio project
      • create a second bundle with an automation operation and export it to a Studio project

      Here are the commands I executed to reproduce the issue:

      mkdir -p nuxeo-op1 && cd $_
      nuxeo bootstrap
      nuxeo bootstrap operation
      nuxeo studio link
      nuxeo studio export
      mkdir -p nuxeo-op2 && cd $_
      nuxeo bootstrap
      nuxeo bootstrap operation
      nuxeo studio link
      nuxeo studio export
      

      Find below the complete reproduction scenario:

      • create first bundle:
        $ mkdir -p nuxeo-op1 && cd $_
        $ nuxeo bootstrap
        
        dxxxxxxxxxxc    oxxo       lxxx lkkl       ;kkk
        dxxxxxxxxxxxd;  oxxo       lxxx lkkkx:.  ,dkkkx
        dxxc       lxxo oxxo       lxxx  "okkkkokkkkd, 
        dxxc       lxxo oxxo       lxxx    .dkkkkkk.                  Welcome to
        dxxc       lxxo oxxo       lxxx   ,dkkkkkkkk,                            Nuxeo CLI
        dxxc       lxxo "oxxcccccccdxxx ,kkkkx" "okkkk,
        loo;       :ooc   "cooooooooool xkko       ckko
        
        :cc,       ;cc;                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        "cxxoooooooxxxo                 oxxxxxxxxxxxxxo
           xoooooooxxxo                 oxxxxxxxxxxxxxo
        
        lkkl       ;kkk oxxxxxxxxxxxxxo xooooooooooo,  
        lkkkx:.  ,dkkkx oxxxxxxxxxxxxxo lxxxxxxxxxxxxb;
         "okkkkokkkkd,  oxxo            lxxd       :xxx
           .dkkkkkk.    oxxxxxxxxxxxxxo lxxd       :xxx
          ,dkkkkkkkk,   oxxo            cxxd       :xxx
        ,kkkkx" "okkkk, oxxxxxxxxxxxxxo  "oxxxxxxxxxxxx
        xkko       ckko oxxxxxxxxxxxxxo    :xxxxxxxxxxx
        
        
             info You'll be prompted for generation of:
             info   nuxeo-op1-core: single-module
        
           create Generating Multi module (Your project parent POM)
             info   Parameters: Use a parent artifact, Parent group, Parent artifact, Parent version, Import nuxeo in the `dependency management`, Nuxeo version, Project group, Project artifact, Project version, Project description
        ? Use a parent artifact (for instance your company's BOM or the org.nuxeo.ecm.distribution:nuxeo-distribution POM)? Yes
        ? Parent Group id: org.nuxeo.ecm.distribution
        ? Parent Artifact id: nuxeo-distribution
        ? Parent Version: 8.10
        ? Project Group id: com.acme
        ? Project Artifact id: nuxeo-op1-parent
        ? Project Version: 1.0-SNAPSHOT
        ? Project Description: 
        
           create Generate Module: nuxeo-op1-core
        
           create Generating Single module
             info   Parameters: Nuxeo version, Project group, Project artifact, Project version, Project description
        ? Project Group id: com.acme.operations
        ? Project Artifact id: nuxeo-op1-core
        ? Project version: 1.0-SNAPSHOT
        ? Project description: 
           create Configuration: multi
           create pom.xml
           create .gitignore
           create nuxeo-op1-core/src/main/resources/META-INF/MANIFEST.MF
           create nuxeo-op1-core/pom.xml
           create nuxeo-op1-core/src/main/java/com/acme/operations/package-info.java
           create nuxeo-op1-core/src/test/resources/jndi.properties
           create nuxeo-op1-core/src/test/resources/log4j.xml
             info You can start editing code or you can continue with calling another generator (nuxeo bootstrap [<generator>..])
        $ nuxeo bootstrap operation
        
        dxxxxxxxxxxc    oxxo       lxxx lkkl       ;kkk
        dxxxxxxxxxxxd;  oxxo       lxxx lkkkx:.  ,dkkkx
        dxxc       lxxo oxxo       lxxx  "okkkkokkkkd, 
        dxxc       lxxo oxxo       lxxx    .dkkkkkk.                  Welcome to
        dxxc       lxxo oxxo       lxxx   ,dkkkkkkkk,                            Nuxeo CLI
        dxxc       lxxo "oxxcccccccdxxx ,kkkkx" "okkkk,
        loo;       :ooc   "cooooooooool xkko       ckko
        
        :cc,       ;cc;                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        "cxxoooooooxxxo                 oxxxxxxxxxxxxxo
           xoooooooxxxo                 oxxxxxxxxxxxxxo
        
        lkkl       ;kkk oxxxxxxxxxxxxxo xooooooooooo,  
        lkkkx:.  ,dkkkx oxxxxxxxxxxxxxo lxxxxxxxxxxxxb;
         "okkkkokkkkd,  oxxo            lxxd       :xxx
           .dkkkkkk.    oxxxxxxxxxxxxxo lxxd       :xxx
          ,dkkkkkkkk,   oxxo            cxxd       :xxx
        ,kkkkx" "okkkk, oxxxxxxxxxxxxxo  "oxxxxxxxxxxxx
        xkko       ckko oxxxxxxxxxxxxxo    :xxxxxxxxxxx
        
        
             info Installation of single-module is skipped.
             info You'll be prompted for generation of:
             info   nuxeo-op1-core: operation
        
           create Generate Module: nuxeo-op1-core
        
           create Generating Operation
             info   Parameters: Operation package, Operation class name, Operation label
        ? Operation package: com.acme.operations
        ? Operation class name: Op1
        ? Operation label: op1
             info Maven dependency: org.nuxeo.ecm.automation:nuxeo-automation-core
             info Maven dependency: org.nuxeo.ecm.automation:nuxeo-automation-test:::test
            force nuxeo-op1-core/pom.xml
            force nuxeo-op1-core/src/main/resources/META-INF/MANIFEST.MF
           create nuxeo-op1-core/src/main/java/com/acme/operations/Op1.java
           create nuxeo-op1-core/src/test/java/com/acme/operations/TestOp1.java
           create nuxeo-op1-core/src/main/resources/OSGI-INF/op1-operation-contrib.xml
             info You can start editing code or you can continue with calling another generator (nuxeo bootstrap [<generator>..])
        $ nuxeo studio link
        
        dxxxxxxxxxxc    oxxo       lxxx lkkl       ;kkk
        dxxxxxxxxxxxd;  oxxo       lxxx lkkkx:.  ,dkkkx
        dxxc       lxxo oxxo       lxxx  "okkkkokkkkd, 
        dxxc       lxxo oxxo       lxxx    .dkkkkkk.                  Welcome to
        dxxc       lxxo oxxo       lxxx   ,dkkkkkkkk,                            Nuxeo CLI
        dxxc       lxxo "oxxcccccccdxxx ,kkkkx" "okkkk,
        loo;       :ooc   "cooooooooool xkko       ckko
        
        :cc,       ;cc;                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        "cxxoooooooxxxo                 oxxxxxxxxxxxxxo
           xoooooooxxxo                 oxxxxxxxxxxxxxo
        
        lkkl       ;kkk oxxxxxxxxxxxxxo xooooooooooo,  
        lkkkx:.  ,dkkkx oxxxxxxxxxxxxxo lxxxxxxxxxxxxb;
         "okkkkokkkkd,  oxxo            lxxd       :xxx
           .dkkkkkk.    oxxxxxxxxxxxxxo lxxd       :xxx
          ,dkkkkkkkk,   oxxo            cxxd       :xxx
        ,kkkkx" "okkkk, oxxxxxxxxxxxxxo  "oxxxxxxxxxxxx
        xkko       ckko oxxxxxxxxxxxxxo    :xxxxxxxxxxx
        
        
             info You are going to link a Studio project to this project.
        ? NOS Username: *STUDIO_USERNAME_HERE*
        ? NOS Password: [hidden]
        ? Studio Project: *STUDIO_PROJECT_HERE*
        ? Do you want to update your Maven settings.xml file accordingly? No
            force pom.xml
            force nuxeo-op1-core/pom.xml
        $ nuxeo studio export
        
        dxxxxxxxxxxc    oxxo       lxxx lkkl       ;kkk
        dxxxxxxxxxxxd;  oxxo       lxxx lkkkx:.  ,dkkkx
        dxxc       lxxo oxxo       lxxx  "okkkkokkkkd, 
        dxxc       lxxo oxxo       lxxx    .dkkkkkk.                  Welcome to
        dxxc       lxxo oxxo       lxxx   ,dkkkkkkkk,                            Nuxeo CLI
        dxxc       lxxo "oxxcccccccdxxx ,kkkkx" "okkkk,
        loo;       :ooc   "cooooooooool xkko       ckko
        
        :cc,       ;cc;                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        "cxxoooooooxxxo                 oxxxxxxxxxxxxxo
           xoooooooxxxo                 oxxxxxxxxxxxxxo
        
        lkkl       ;kkk oxxxxxxxxxxxxxo xooooooooooo,  
        lkkkx:.  ,dkkkx oxxxxxxxxxxxxxo lxxxxxxxxxxxxb;
         "okkkkokkkkd,  oxxo            lxxd       :xxx
           .dkkkkkk.    oxxxxxxxxxxxxxo lxxd       :xxx
          ,dkkkkkkkk,   oxxo            cxxd       :xxx
        ,kkkkx" "okkkk, oxxxxxxxxxxxxxo  "oxxxxxxxxxxxx
        xkko       ckko oxxxxxxxxxxxxxo    :xxxxxxxxxxx
        
        
             info Building and exporting your contributions to '*STUDIO_PROJECT_HERE*' Studio project.
        
             info Contributions sucessfully exported to '*STUDIO_PROJECT_HERE*' Studio project.
        
      • go to the Studio project and navigate to SETTINGS > Automatic Registries, the following is displayed:
        {
          "operations": [
            {
              "id": "Document.Op1",
              "aliases": [],
              "signature": [
                "void",
                "document"
              ],
              "category": "Document",
              "label": "op1",
              "requires": null,
              "since": "",
              "description": "Describe here what your operation does.",
              "params": [
                {
                  "name": "path",
                  "description": "",
                  "type": "string",
                  "widget": null,
                  "values": [],
                  "order": 0,
                  "required": false
                }
              ]
            }
          ]
        }
        
      • create a second bundle:
        $ cd ..
        $ mkdir -p nuxeo-op2 && cd $_
        $ nuxeo bootstrap
        
        dxxxxxxxxxxc    oxxo       lxxx lkkl       ;kkk
        dxxxxxxxxxxxd;  oxxo       lxxx lkkkx:.  ,dkkkx
        dxxc       lxxo oxxo       lxxx  "okkkkokkkkd, 
        dxxc       lxxo oxxo       lxxx    .dkkkkkk.                  Welcome to
        dxxc       lxxo oxxo       lxxx   ,dkkkkkkkk,                            Nuxeo CLI
        dxxc       lxxo "oxxcccccccdxxx ,kkkkx" "okkkk,
        loo;       :ooc   "cooooooooool xkko       ckko
        
        :cc,       ;cc;                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        "cxxoooooooxxxo                 oxxxxxxxxxxxxxo
           xoooooooxxxo                 oxxxxxxxxxxxxxo
        
        lkkl       ;kkk oxxxxxxxxxxxxxo xooooooooooo,  
        lkkkx:.  ,dkkkx oxxxxxxxxxxxxxo lxxxxxxxxxxxxb;
         "okkkkokkkkd,  oxxo            lxxd       :xxx
           .dkkkkkk.    oxxxxxxxxxxxxxo lxxd       :xxx
          ,dkkkkkkkk,   oxxo            cxxd       :xxx
        ,kkkkx" "okkkk, oxxxxxxxxxxxxxo  "oxxxxxxxxxxxx
        xkko       ckko oxxxxxxxxxxxxxo    :xxxxxxxxxxx
        
        
             info You'll be prompted for generation of:
             info   nuxeo-op2-core: single-module
        
           create Generating Multi module (Your project parent POM)
             info   Parameters: Use a parent artifact, Parent group, Parent artifact, Parent version, Import nuxeo in the `dependency management`, Nuxeo version, Project group, Project artifact, Project version, Project description
        ? Use a parent artifact (for instance your company's BOM or the org.nuxeo.ecm.distribution:nuxeo-distribution POM)? Yes
        ? Parent Group id: org.nuxeo.ecm.distribution
        ? Parent Artifact id: nuxeo-distribution
        ? Parent Version: 8.10
        ? Project Group id: com.acme
        ? Project Artifact id: nuxeo-op2-parent
        ? Project Version: 1.0-SNAPSHOT
        ? Project Description: 
        
           create Generate Module: nuxeo-op2-core
        
           create Generating Single module
             info   Parameters: Nuxeo version, Project group, Project artifact, Project version, Project description
        ? Project Group id: com.acme.operations
        ? Project Artifact id: nuxeo-op2-core
        ? Project version: 1.0-SNAPSHOT
        ? Project description: 
           create Configuration: multi
           create pom.xml
           create .gitignore
           create nuxeo-op2-core/src/main/resources/META-INF/MANIFEST.MF
           create nuxeo-op2-core/pom.xml
           create nuxeo-op2-core/src/main/java/com/acme/operations/package-info.java
           create nuxeo-op2-core/src/test/resources/jndi.properties
           create nuxeo-op2-core/src/test/resources/log4j.xml
             info You can start editing code or you can continue with calling another generator (nuxeo bootstrap [<generator>..])
        $ nuxeo bootstrap operation
        
        dxxxxxxxxxxc    oxxo       lxxx lkkl       ;kkk
        dxxxxxxxxxxxd;  oxxo       lxxx lkkkx:.  ,dkkkx
        dxxc       lxxo oxxo       lxxx  "okkkkokkkkd, 
        dxxc       lxxo oxxo       lxxx    .dkkkkkk.                  Welcome to
        dxxc       lxxo oxxo       lxxx   ,dkkkkkkkk,                            Nuxeo CLI
        dxxc       lxxo "oxxcccccccdxxx ,kkkkx" "okkkk,
        loo;       :ooc   "cooooooooool xkko       ckko
        
        :cc,       ;cc;                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        "cxxoooooooxxxo                 oxxxxxxxxxxxxxo
           xoooooooxxxo                 oxxxxxxxxxxxxxo
        
        lkkl       ;kkk oxxxxxxxxxxxxxo xooooooooooo,  
        lkkkx:.  ,dkkkx oxxxxxxxxxxxxxo lxxxxxxxxxxxxb;
         "okkkkokkkkd,  oxxo            lxxd       :xxx
           .dkkkkkk.    oxxxxxxxxxxxxxo lxxd       :xxx
          ,dkkkkkkkk,   oxxo            cxxd       :xxx
        ,kkkkx" "okkkk, oxxxxxxxxxxxxxo  "oxxxxxxxxxxxx
        xkko       ckko oxxxxxxxxxxxxxo    :xxxxxxxxxxx
        
        
             info Installation of single-module is skipped.
             info You'll be prompted for generation of:
             info   nuxeo-op2-core: operation
        
           create Generate Module: nuxeo-op2-core
        
           create Generating Operation
             info   Parameters: Operation package, Operation class name, Operation label
        ? Operation package: com.acme.operations
        ? Operation class name: Op2
        ? Operation label: op2
             info Maven dependency: org.nuxeo.ecm.automation:nuxeo-automation-core
             info Maven dependency: org.nuxeo.ecm.automation:nuxeo-automation-test:::test
            force nuxeo-op2-core/pom.xml
            force nuxeo-op2-core/src/main/resources/META-INF/MANIFEST.MF
           create nuxeo-op2-core/src/main/java/com/acme/operations/Op2.java
           create nuxeo-op2-core/src/test/java/com/acme/operations/TestOp2.java
           create nuxeo-op2-core/src/main/resources/OSGI-INF/op2-operation-contrib.xml
             info You can start editing code or you can continue with calling another generator (nuxeo bootstrap [<generator>..])
        $ nuxeo studio link
        
        dxxxxxxxxxxc    oxxo       lxxx lkkl       ;kkk
        dxxxxxxxxxxxd;  oxxo       lxxx lkkkx:.  ,dkkkx
        dxxc       lxxo oxxo       lxxx  "okkkkokkkkd, 
        dxxc       lxxo oxxo       lxxx    .dkkkkkk.                  Welcome to
        dxxc       lxxo oxxo       lxxx   ,dkkkkkkkk,                            Nuxeo CLI
        dxxc       lxxo "oxxcccccccdxxx ,kkkkx" "okkkk,
        loo;       :ooc   "cooooooooool xkko       ckko
        
        :cc,       ;cc;                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        "cxxoooooooxxxo                 oxxxxxxxxxxxxxo
           xoooooooxxxo                 oxxxxxxxxxxxxxo
        
        lkkl       ;kkk oxxxxxxxxxxxxxo xooooooooooo,  
        lkkkx:.  ,dkkkx oxxxxxxxxxxxxxo lxxxxxxxxxxxxb;
         "okkkkokkkkd,  oxxo            lxxd       :xxx
           .dkkkkkk.    oxxxxxxxxxxxxxo lxxd       :xxx
          ,dkkkkkkkk,   oxxo            cxxd       :xxx
        ,kkkkx" "okkkk, oxxxxxxxxxxxxxo  "oxxxxxxxxxxxx
        xkko       ckko oxxxxxxxxxxxxxo    :xxxxxxxxxxx
        
        
             info You are going to link a Studio project to this project.
        ? NOS Username: *STUDIO_USERNAME_HERE*
        ? NOS Password: [hidden]
        ? Studio Project: *STUDIO_PROJECT_HERE*
        ? Do you want to update your Maven settings.xml file accordingly? No
            force pom.xml
            force nuxeo-op2-core/pom.xml
        $ nuxeo studio export
        
        dxxxxxxxxxxc    oxxo       lxxx lkkl       ;kkk
        dxxxxxxxxxxxd;  oxxo       lxxx lkkkx:.  ,dkkkx
        dxxc       lxxo oxxo       lxxx  "okkkkokkkkd, 
        dxxc       lxxo oxxo       lxxx    .dkkkkkk.                  Welcome to
        dxxc       lxxo oxxo       lxxx   ,dkkkkkkkk,                            Nuxeo CLI
        dxxc       lxxo "oxxcccccccdxxx ,kkkkx" "okkkk,
        loo;       :ooc   "cooooooooool xkko       ckko
        
        :cc,       ;cc;                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        dxxc       lxxo                 oxxxxxxxxxxxxxo
        dxxc       lxxo                 oxxo           
        "cxxoooooooxxxo                 oxxxxxxxxxxxxxo
           xoooooooxxxo                 oxxxxxxxxxxxxxo
        
        lkkl       ;kkk oxxxxxxxxxxxxxo xooooooooooo,  
        lkkkx:.  ,dkkkx oxxxxxxxxxxxxxo lxxxxxxxxxxxxb;
         "okkkkokkkkd,  oxxo            lxxd       :xxx
           .dkkkkkk.    oxxxxxxxxxxxxxo lxxd       :xxx
          ,dkkkkkkkk,   oxxo            cxxd       :xxx
        ,kkkkx" "okkkk, oxxxxxxxxxxxxxo  "oxxxxxxxxxxxx
        xkko       ckko oxxxxxxxxxxxxxo    :xxxxxxxxxxx
        
        
             info Building and exporting your contributions to '*STUDIO_PROJECT_HERE*' Studio project.
        
             info Contributions sucessfully exported to '*STUDIO_PROJECT_HERE*' Studio project.
        
      • go to the Studio project and navigate to SETTINGS > Automatic Registries, the following is displayed:
        {
          "operations": [
            {
              "id": "Document.Op2",
              "aliases": [],
              "signature": [
                "void",
                "document"
              ],
              "category": "Document",
              "label": "op2",
              "requires": null,
              "since": "",
              "description": "Describe here what your operation does.",
              "params": [
                {
                  "name": "path",
                  "description": "",
                  "type": "string",
                  "widget": null,
                  "values": [],
                  "order": 0,
                  "required": false
                }
              ]
            }
          ]
        }
        

      Expected result: 2 automation operations are defined in the Studio project
      Actual result: only the latest exported auotmation operation is defined in the Studio project

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  PagerDuty