Skip to Content

How to correctly use the component-concept with multiple components

Hi,

i am working on a multicomponent-application.

This means i have 3 eclipse-projects, in each one component.

How can i link these 3 projects to work (also in the local test).

Component 1:

WebContent

app_one

Component.js

jQuery.sap.declare("app_one.Component");
ap.ui.core.Component.extend("app_one.Component", {
  metadata : {
  library: "app_one",
  name : "Corelib",
  version : "1.0",
  includes : [],
  dependencies : {
  libs : [ "sap.m" ]
  },
  },
});

Component 2:

WebContent

app_two

Component.js

jQuery.sap.declare("app_two.Component");
ap.ui.core.Component.extend("app_two.Component", {
  metadata : {
  library: "app_two",
  name : "Entitieslib",
  version : "1.0",
  includes : [],
  dependencies : {
  libs : [ "sap.m" ],
components : ["app_one"]
  },
  },
});

Component 3:

WebContent

app_launcher

Component.js

jQuery.sap.declare("app_launcher.Component");
sap.ui.core.UIComponent.extend("app_launcher.Component", {
  metadata : {
  name : "Launcher",
  version : "1.0",
  includes : [],
  dependencies : {
  libs : [ "sap.m" ],
components : ["app_two"]
  },
  },
});

I think this must be working in any way!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Dec 11, 2014 at 06:14 AM

    So, the only way to solve this seems to be an implicit enhancement of the UI5-Handler in SICF.

    If i give a special prefix , like sap did it with "resources/" it gives you the source from an additional ui5-application.

    best regards

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 09, 2014 at 07:02 AM

    Does anyone has an idea?😔

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 09, 2014 at 01:55 PM

    Hi Michael,

    I don't really understand your problem. All your components have unique names, the components are in different folders. Now you just have to map the name to the folder like this:

    jQuery.sap.registerModulePath("app_one", "app_one");

    jQuery.sap.registerModulePath("app_two", "app_two");

    jQuery.sap.registerModulePath("app_launcher", "app_launcher");

    (Or the short form in this case: sap.ui.localResources("app_one") [...])

    After that you can just say

    new sap.ui.core.ComponentContainer({ name : "app_one" });

    HTH,

    Jens

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Michael Roger

      You can decide for yourself where you want to put the files on your sever. You just have to change the paths in the index.html of your application to reflect that decision.

      You can put all components into one project, make a project for every component or something in between - that is completely up to you as the developer.

      The idea behind this is that every component has a unique namespace and is somewhere on the server - you just configure this paths on the client-side using resourceroots/registerModulePath.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.