GradleException: Unable to find SCSS file

Hi,

So my project worked okay till now. I got this exception when I tried to start in cuba Studio:



BUILD FAILED

Total time: 6.624 secs
[08:21:02.493] Task 'deploy, start' failed
org.gradle.api.GradleException: Unable to find SCSS file ...\myproject\modules\web\build\themes-tmp\VAADIN\themes\bin\styles.scss

And this is not the first time.
Sometimes it randomly happens. But I did not modify the VAADIN theme neither the scss files, So I am sure it is lying. Now I have a headache from it. Lots of time I had to restart my work from a backup. And it is really unpleasant.
Nowadays I found that, if I delete bin folder from here: …\myproject\modules\web\themes\ then it is build and works.

Why? What happens why it can’t build my project?

Thanks.

3 Likes

Hi
Something is wrong with the build.gradle that you have shared. Did you make the mistake during sharing it (pasted the code twice)?

See the code inside “sourceSets” on line 211.


...
configure(webThemesModule) {
    apply(plugin: 'java')
    apply(plugin: 'maven')
    apply(plugin: 'cuba')

    appModuleType = 'web-themes'

    buildDir = file('../build/scss-themes')

    sourceSets {
	
buildscript {
    ext.cubaVersion = '6.4.2'
    repositories {
        maven {
            url 'https://repo.cuba-platform.com/content/groups/work'
            credentials {
                username(rootProject.hasProperty('repoUser') ? rootProject['repoUser'] : 'cuba')
                password(rootProject.hasProperty('repoPass') ? rootProject['repoPass'] : 'cuba123')
            }
        }
        maven {
            url 'https://repo.cuba-platform.com/content/groups/premium'
            credentials {
                username(rootProject.hasProperty('premiumRepoUser') ? rootProject['premiumRepoUser'] : System.getenv('CUBA_PREMIUM_USER'))
                password(rootProject.hasProperty('premiumRepoPass') ? rootProject['premiumRepoPass'] : System.getenv('CUBA_PREMIUM_PASSWORD'))
            }
        }
    }

...

No, somewhy it is originally there. I did not modify this file :confused:
And in the working project is looks like the same. If I delete the second maven{…} I get an error:

Total time: 0.934 secs
[08:21:34.706] Task 'setupTomcat, deploy, start' failed
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.haulmont.reports:reports-global:6.4.2.
Searched in the following locations:
    https://repo.cuba-platform.com/content/groups/work/com/haulmont/reports/reports-global/6.4.2/reports-global-6.4.2.pom
    https://repo.cuba-platform.com/content/groups/work/com/haulmont/reports/reports-global/6.4.2/reports-global-6.4.2.jar
Required by:
    project : 

I meant not the second “maven()”. The whole code which should be in the build.gradle is also pasted to "sourceSets { " at line 209.

Hi.

I had the same problem.

Please check files (where com.company.app is you package namespace):

modules/web/themes/halo/styles.scss


@import "halo-defaults";
@import "com.company.app/halo-ext-defaults";
@import "app-components";
@import "com.company.app/halo-ext";
.halo {
  // include auto-generated app components SCSS
  @include app_components;
  
  @include com_com_company.app-halo-ext;
}

modules/web/themes/halo/com.company.app/halo-ext.scss


@mixin com_comapany_app-halo-ext {
}

modules/web/themes/halo/com.company.app/app-components.scss


@import "halo-ext";
@mixin com_comapany_app {
  @include com_comapany_app-halo-ext;
}

Hi,

These files are the same that you wrote :expressionless:

Hi, could you bring some details?
Did you create theme extensions? Did you add custom Vaadin components?
Could you share your build.gradle?

If no, have you got ideas of how the “bin” directory appeared in the .\myproject\modules\web\themes</i> ? Which contents has it?

Hi,
Of course I can.
Yes I created a new theme, based this documentation. But I did not changed much things.
No, I didn’t add custom Vaadin components.
Okay, I attached that.
And I have no idea why or how appeared the bin directory. I did the usual things. Friday I build my project, tested and left it as it works. And no theme modification. Monday morning I wanted to start it and then I got that exception. Unfortunately, I could not recognize what could occurs that exception.
The bin stucture is:


+.settings
      - org.eclipse.jdt.core.prefs
+halo
       + branding
           - app-icon-login.png
           - app-icon-menu.png
       + com.company.myproject
           - app-components.scss
           - halo-ext.scss
           - halo-ext-defaults.scss
       - favico,ico
       - style.scss
+havana //looks same lik halo
  .classpath

build.gradle.txt (13.1K)

Hi

Same here, it is related to IDEA 2017.2.

Was working on Friday and now error below. Moved from platform 6.5.5 to 6.5.7 today hoping issue was solved, it isn’t. Also moved to IDEA 2017.2. few days ago.

[09:52:22.723] Task ‘assemble’ failed
org.gradle.api.GradleException: Unable to find SCSS file …\modules\web\build\themes-tmp\VAADIN\themes\out\styles.scss

Made a clean, no change. Seems that build process thinks that ‘out’ is a legit theme, where it is in fact a product from build process within IDEA, and only when building from IDEA.

The generated dir structure which is problematic is
+web/themes/out
+production
+resources
+halo

IDEA compiling was using ‘out’ directories (default for projects), I set it to ‘build’ like studio, then cleaned everything. Assemble then worked but was not sure this is the solution.

Then the problem reappeared later. I just deleted the “…/modules/web/themes/out” directory then Studio was able to compile. But when I compile from IDEA the ‘out’ theme reappears, which is strange, because IDEA is supposed to replicate gradle build.

Tried to update gradle wrapper, no change. Project clean in Studio does not remove the ‘out’ theme either.

Tried with a fresh new project where i created a theme extension, same issue.

Then reverted to IDEA 2017.1.5 and problem seems gone.

Mike

Any updated on this issue. I started facing this recently and can assure that its some bug. The same code same config works on VM and fellow developers. It just stops working on my setup.
Only solution I found so far to delete the whole project folder, reclone and add as project in studio

Let me know how I can help in debugging this.

Hi,
Could you describe your actions step by step? What exactly do you do?

Hi,

have the same issue here. After “Studio”>“Create theme extension” there is sporadic the issue

Caused by: org.gradle.api.GradleException: Unable to find SCSS file /xxxx/xxxx/xxx/modules/web/build/themes-tmp/VAADIN/themes/bin/styles.scss
        at CubaWebScssThemeCreation.compileScss(CubaWebScssThemeCreation.groovy:450)

Any ideas ?

Regards,
jj

I know this always works for me - deleting the folder modules/web/themes/bin and then build again.

1 Like

Following solution helps me, please add following gradle task to your build.gradle file. It removes the bin directories.

   clean.doFirst {
    delete "modules/core/bin"
    delete "modules/web/bin"
    delete "modules/web/themes/bin"
    delete "modules/gui/bin"
    delete "modules/global/bin"
}

Then you will able to build the artifacts with

./gradlew clean build

Thank you guys.

I added

apply plugin: 'base'

clean.doFirst {
    delete "modules/core/bin"
    delete "modules/web/bin"
    delete "modules/web/themes/bin"
    delete "modules/gui/bin"
    delete "modules/global/bin"
}

to the extra.gradle file. Lets see if it helps.

Best Regards,
jj

@juergen.jetmar one last question, which kind of IDE did you used?

The issue happens to me only when I was working with eclipse or visual studio code, they compile the artifacts to bin folder.

1 Like

Hi Mike,

I;m using VSC and IDEA. VSC for the simple things and navigation between a number of projects and IDEA for the more complex things.

Hi,

I’d better set themes property of buildScssThemes task in build.gradle:

    task buildScssThemes(type: CubaWebScssThemeCreation) {
        themes = ['halo']
    }

In this case, Gradle task will not try to use bin directory as theme source.

2 Likes

Hi, works for me. thx. Do you see a way how to put the buildScssThemes gradle tasks to the extra.gradle. The build.gradle is partially generated and is sometimes overwritten.

1 Like