Eclipse does not recognize static web content under src/main/resources/static - angularjs

I am working on a Spring boot web project. I have an index.html file under src/main/webapp, and a .js file under src/main/resources/static/js.
Eclipse is complaining on the <script></script> inclusion inside the index.html file: Undefined Javascript file.
The above is also the case for css files under src/main/resources/static/css.
In addition, I'm using wro to generate unified angularjs-bootstrap js and css files, which are generated under target\generated-resources\static and Eclipse cannot find them either.
Is there any way to configure Eclipse to include the above directories?

The javascript and css files must be placed under src/main/webapp so that they go in the correct location when the final WAR is built. Files placed under src/main/resources will be placed in the java class path of the WAR when it is deployed (i.e., under the classes directory of the WAR). You should update your project by placing css/javascript files under src/main/webapp. wro can also be configured to work properly with eclipse see: CSS and JS minification using Eclipse, Maven and WRO4J

Related

Creating a NativeScript custom UI plugin with TypeScript

I'm trying to create a custom UI plugin in TypeScript
Here's the steps I'm taking
create a plugin project in a local folder
write .ts files for custom UI in the plugin project root
generate .js files out of those .ts files with tsc command in the plugin project root
go to the test NativeScript project and run tns plugin add <local plugin path> to include the created plugin
But I get compiling errors at step 3 because I have importing statements as follows
import { ContentView } from "ui/content-view";
import...
I referenced an example here https://github.com/NathanWalker/nativescript-cardview/blob/master/cardview.ios.ts
My question is how cardview.ios.ts in the example 'nativescript-cardview' is being compiled to cardview.io.js? It seems impossible to do this...
In the plugin, you have referenced the author has created a demo app and is using the declaration file for tns-core-modules from that demo. Look at this line where tns-core-modules.d.ts is included in tsconfig.json
You can follow this practice for testing cases and for your release you can create a relative path to the tns-core-modules (and references) declaration files from the app node_modules folder like done here
As a side note noEmiOnError flag in your package.json will allow the translation to continue without hanging on errors.
Thanks for linking to your repo. NativeScript's docs state that "if you are using a transpiler, make sure to include the transpiled JavaScript files in your plugin".
Your package.json specifies cardview.js as the entrypoint, but your transpiled JavaScript files haven't been added to the repo. I solved this problem in my nativescript-midi plugin by committing the transpiled files in a \dist directory. The plugin is written in ES 6 but transpiled to ES 5 for consumption. To make sure that the src and dist directories remain in sync, I use a git pre-commit hook that automatically runs the build command and commits the results. If you clone the nativescript-midi repo, you can view it in .git/hooks/pre-commit . A benefit of using this approach for your plugin is that it will also allow it to be used by developers who are not using TypeScript.

easing the gradle build process in deploying spring boot and angular js application

I am working on gradle based spring boot and angularjs project. I have all my angularjs code in static folder which is committed to Git. We need to deploy it into a server which does not have access to internet. So I have generated dist contents using gulp serve:dist and replaced the contents in the static folder with the contents of dist folder. Then I have generated jar file and deployed in server.
So it is becoming manually cumbersome every time to replace the contents of static folder with the contents of dist generating jar file then removing the dist folder contents from static folder and then replacing it with original angular js code.
Is there any possibility to generate the jar file directly using the contents from dist folder instead using the contents in static folder?
I am not sure whether I made the problem clear or not. Please update me if you need any further clarification.
If you are using Spring Boot with standalone JAR deployment, you just need to output front-end assets into src/main/resources/static and Spring Boot will serve them via embedded container.
You can use Gradle Gulp Plugin to execute Gulp build as task within main Gradle build.
Reaction on comment:
Mentioned static folder of course contains only assets you intend to serve by Spring Boot. It wouldn't contain code or anything else. You can have your code in e.g. [projectRoot]/jsSrc. Just Gulp needs to know where to find these files.
We are using such directory structure without any problems (with CI build running on every commit). If manual action is needed to build project, your build is fundamentally broken. In this case your issue is misplaced JS source files.

What about AngularJS typescript files after compiling?

I created a web application using angularJS with typescript in Visual Studio 2015.
Is it possible to add the generated .js files automatically to the project after compiling?
Do I have to delete the .ts files before deploying to Azure or something like that?
Is it possible to add the generated .js files automatically to the project after compiling?
If the ts file is included with as <TypeScriptCompile in the project file (should happen automatically if you have TypeScript tools for Visual Studio) VS will compile and generate a js file.
Do I have to delete the .ts files before deploying to Azure or something like that?
No. However you should have the generated .js files included in the project to ensure they get deployed after build.

project setup for Angular & webpack

i am trying trying to create a project with webpack, angular and gulp. Webpack creates a bundle file called build.js and an index.html from a template. When the browser enters the webpage i want it to go directly to a login screen by using ui-route.
this is how my directory structure looks like.
Firstly my problem is that the bundle only includes the entry file, app.module.js. I can require the other js files in app.module.js to have them in the bundle to but when this project grows it will be a lot of files to be required in one file. So is it possible to bundle all js files except the once in node_modules folder?
My next problem is that when the build.js and index.html has been created in the dist/build folder i cant seem to find the rest of the html files in the project if they are not in the build folder.
Not sure how your webpack config looks like, but many times the HTML is processed by webpack and might end up in your JS bundle (as a string) that then can be used by Angular.

File Path to jar inside another jar

For an Eclipse plugin, I need to refer to a jar file inside the plugin directory (to provide code to users). This works perfectly when running the plugin while developing (inside a runtime-eclipse-application).
But when I build an update site, my plugin is built into a jar file. File paths for images are still working, but when the jar should be imported, eclipse shows the following error:
Description Resource Path Location Type
The container 'DoodleDebug' references non existing library 'file:\C:\Users\Me\.eclipse\org.eclipse.platform_3.7.0_740800064\plugins\ch.unibe.scg.doodledebug_1.0.0.201208281642.jar!\DoodleDebug-Client.jar'
The outer jar path is correct and when inspecting it with WinRAR, I can see the desired jar file inside it!
Why isn't this working as expected?
You will need to install your plugin in an exploded form. To do this, in your MANIFEST.MF file, add the following line:
Eclipse-BundleShape: dir
This will ensure that your plugin is installed as a directory, not a jar file. There is no way to reference nested jars, so they must be exploded.
See here for more information: http://eclipsesource.com/blogs/2009/01/20/tip-eclipse-bundleshape/

Resources