on 2015 Jul 23 1:39 PM
Dear experts,
We have a custom central UI5 library to host common functions and this has been loading fine as 'resources' for existing apps(without manifest.json).
Now I have created a new project from template in WebIDE(with manifest.json) and have mentioned library name in libs section.
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.layout": {},
"custom.lib.central": {}
}
When testing the project in local sandbox, libraries are not loaded and are giving error - failed to load 'custom/lib/central/library.js' from ../resources/namespace/custom/lib/central/library.js: 404 - Not Found.
I have tried adding path in neo-app.json but it doesn't help.
{
"path": "/resources",
"target": {
"type": "application",
"name": "customlibcentral",
"preferLocal": true
},
"description": "SAPUI5 Resources"
},
Any ideas?
Best Regards - Anuraag
Hi Anuraag,
When consuming libraries from an application in SAP Web IDE preview you have to specify from where they should be loaded: local workspace or HCP. The default is to consume from HCP.
If you want to consume the library from workspace you have to create a run configuration with property "Use my workspace first" checked. When running such run configuration web ide will scan consuming app neo-app.json routes of type "application" and try to find a matching project in the workspace.
This match is performed by comparing the route name to the hcpdeploy.name in the .project.json of the libraries in the workspace.
For example (matching names in bold):
Consuming App neo-app.json file
"routes": [{
"path": "/resources",
"target": {
"type": "application",
"name": "reusepoclib"
},
"description": "Reuse PoC Library"
}, {
Library .project.json file
{
"hcpdeploy":
{
"account": "fiori",
"name": "reusepoclib",
"entryPath": "src"
},
If a match was found a mapping path is added to preview url.
For example:
hc_wsmapping.reusepoclib%3D%252Fwatt%2524I022338-OrionContent%252Freusepoc.lib%252Fsrc%26
Where reusepoclib is the application name as it appears in neo-app.json and reusepoc.lib is the project name in the user's workspace. src is the entryPath to consume the library artifacts (entryPath in hcpdeploy block).
The entryPath depends on ui5 version of the library. For libraries created after ui5 1.30 version, build process will flatten library namespace. It means that deployed libraries will have library.js below root when libraries in workspace (not yet built) still contain the namespace.
For example:
reusepoc.lib/src/sap/gr/reuse/lib.
For new libraries the neo-app.json/.project.json configurations should be:
Consuming App neo-app.json file
"routes": [{
"path": "/resources/libnamespace", (e.g.: sap/gr/reuse/lib)
"target": {
"type": "application",
"name": "reusepoclib"
},
"description": "Reuse PoC Library"
}, {
Library .project.json file
{
"hcpdeploy":
{
"account": "fiori",
"name": "reusepoclib",
"entryPath": "src/libnamespace" (e.g.: sap/gr/reuse/lib)
},
Regards, Sergio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sergio. Thanks for the call yesterday !
Final steps that are working to load reuse library:
1. Create a new project from template - SAP Worklist
2. Add reuse library to dependencies in manifest.json
3. Add routes for reuse library to neo.app.json
4. Create a run configuration(type: SAP Fiori Component on Sandbox) with option 'Use my workspace first' as checked.
5. Run this configuration and app will fail to load (reasons not known and still being investigated)
6. Close the running app. Click on manifest.json and use Run from toolbar. App and reuse library will load properly.
Note: After all this, if you make some changes to app and run it(click manifest.json and run), sometimes the reuse fails to load. This is because workspace settings in .user.project.json change somehow(again reasons not known) from withWorkspace to withoutWorkspace. --> This shoud be changed to withWorkspace and app will be up again.
Best Regards - Anuraag
Hi sergio.rozenszajn,
I am also facing same issue, but in my case it's just reverse. if i run my app by requesting load library in web-ide working fine but when i am launching same app from FLP not working. I have posted all details in below link.
https://answers.sap.com/questions/13005779/custom-library-not-loading-in-custom-ui5-app-404-e.html
Any suggestion what could be the wrong?
Thanks in Advance.
Regards
Mohd Iqbal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
12 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.