The
neo-app.json file is used only by
SAP Web IDE to define paths. Another software, for example
Jenkins, ignores that file. Thus, all the paths that are defined in that file are ignored by any other software.
I encountered an issue where a project would accept a different path for importing
sap-ui-core.js from
SAP Web IDE than it was from
Jenkins. The application I was working with was rather old and this is why I had this issue and newer applications do not have this issue.
Resolving the issue is a very short process. All I had to do was add some entries for every file imports that had an issue with its path. For example, in my project in
SAP Web IDE, the path to
sap-ui-core.js would be:
../../../sap-ui-core.js
and in Jenkins it would be:
../../sap-ui-core.js
This is because
Jenkins removes the
webapp folder, which makes the
sap-ui-core.js file one directory closer.
I had this issue on the file
opaTests.qunit.html, so let me base this article on this file.
Here is what the
opaTests.qunit.html file looked like as imported from
Jenkins:
<!DOCTYPE html>
<html>
<head>
<title>Opa tests for Project</title>
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta charset="UTF-8">
<script id="sap-ui-bootstrap"
src="../../resources/sap-ui-core.js"
data-sap-ui-resourceroots='{
"project.test": "../",
"project.test.app" : "../flpSandboxMockServer"
}'>
</script>
<script>
jQuery.sap.require("project.test.integration.AllJourneys");
</script>
</head>
<body>
<div id="content"></div>
<h1 id="qunit-header">Opa tests for Project</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</body>
</html>
Once I launched the file, it would give me a
net::ERR_ABORTED 404 error, mentioning that it could not find the file
sap-ui-core.js from this location (as seen from the Chrome Developer Tools):
I added the .com from the URL to show you all the information from the relative path to the
sap-ui-core.js file. The first
/, of course, is the root folder of the website.
Resolving the Path Issue
The fix for this is very simple. Go to your
neo-app.json file, and add a duplicate entry to that of the
resources folder, because
sap-ui-core.js belongs in the
resources folder. The elements to duplicate have been put below. In my case, I had two paths to duplicate because I had two entries with the same path in my
neo-app.json file.
{
"path": "/resources",
"target": {
"type": "application",
"name": "sapui5preview",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
}, {
"path": "/resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
}
Once you have duplicated these entries, you will have to modify the
path variable of that entry. The path would be what the error was complaining about:
Thus, the
path variable of our duplicate entries would be
/webapp/resources. Now, it can be understood that the
path variable is the location that you want a folder to be accessible from, and the
entryPath is the actual location of that folder in your system.
In the end, this would result in this being
added to your
neo-app.json file:
{
"path": "/webapp/resources",
"target": {
"type": "application",
"name": "sapui5preview",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
}, {
"path": "/webapp/resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
}
Repeat these steps for any file that gives you a
404 error!
To recap, these are the steps you have to do:
1- Find the path SAP Web IDE is using to find a file using your web developer tools (in my case, "/webapp/resources/sap-ui-core.js"
2- Duplicate all entries in the neo-app.json file that concerns the folder the file is located in (in my case, it is "resources")
3- Modify the path variable of those duplicate entries to correspond with the location the error was mentioning there was no such file (in my case, "/webapp/resources").
Happy coding!
Alexandre Therrien