Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web resources node #46

Open
AlexFalappa opened this issue Oct 8, 2016 · 2 comments
Open

Web resources node #46

AlexFalappa opened this issue Oct 8, 2016 · 2 comments

Comments

@AlexFalappa
Copy link
Owner

One or two nodes in the project view for web resources showing the content of src/main/resources/static and src/main/resources/templates folders

@AlexFalappa AlexFalappa added this to the Future milestone Oct 8, 2016
@janScheible
Copy link

First: Cool to have a Spring Boot plugin for Netbeans. :-)

Would implementing this ticket enable LESS compilation on save support?

The current status is that the following dialog appears when saving a ".less" file:

Do you want to configure automatic LESS compilation on save?
Note that you can always turn this on (or off) later in Project Properties.

I even see INFO [CPOnSaveHook]: processSavedFile called for LESS type on project d:/project. in the logs.

But neither is the css file generated nor is there any way to change the setting in the project properties (the tab is not even showed).

I tried to fix it on my own but had no success so far.
To not lose the knowledge I gained I will add some notes to this ticket.

I looked at the source code of Netbeans and it looks to me that CPOnSaveHook is only responsible for that dialog and not for triggering the invocation of LESS.
I did some more research and found a real gem: http://hg.netbeans.org/main-silver/rev/306e875d1344
This is the original commit which added less support to Maven WAR projects.

I made a pretty simple try and added

<dependency>
    <groupId>org.netbeans.modules</groupId>
    <artifactId>org-netbeans-modules-web-common-ui</artifactId>
    <version>${netbeans.api.version}</version>
</dependency>
<dependency>
    <groupId>org.netbeans.modules</groupId>
    <artifactId>org-netbeans-modules-web-common</artifactId>
    <version>${netbeans.api.version}</version>
</dependency>

as dependencies and the following code to the the SpringBootServiceInitializer#projectOpened():

final CssPreprocessorsListener cssSupport = prj.getLookup().lookup(CssPreprocessorsListener.class);
if (cssSupport != null) {
    CssPreprocessors.getDefault().addCssPreprocessorsListener(cssSupport);
}

But it ends up in a ClassNotFoundException. I have no idea why... the dependency is added to the pom.
I have to admit that I have no Netbeans plugin coding experience.

Another source of inspiration might be https://github.com/hildo/netbeans-gradle-javaee-project.
The scope sounds pretty similar.
I also found a forum thread initiated by the author of that plugin: http://netbeans-org.1045718.n5.nabble.com/How-to-start-for-netbeans-gradle-javaee-plugin-td5730673.html.

@AlexFalappa
Copy link
Owner Author

@janScheible to answer your first question, unfortunately no, solving this issue would not automatically enable support for CSS preprocessors.

This issue only covers the presentation aspect: it aims at better showing int the Project view the web resources (html pages, css files, javascript files and so on) only for Spring Boot projects maven projects with JAR packaging, the idea is to make them look like in maven projects with WAR packaging.

You should try to change the packaging type to war in your pom.xml and check if preprocessor support get enabled as a consequence. This is obviously not a proper solution.

Anyway thank you for your investigation and the notes you added, I'm going to add a new issue and point it here for future reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants