tuplejump / play-yeoman

Play + Yeoman integration sbt and play plugins
Apache License 2.0
238 stars 57 forks source link

activator dist does not run grunt dist target #90

Open JCDClark opened 8 years ago

JCDClark commented 8 years ago

Hi.

When using the activator to do a dist build (activator dist), the command that is executed by the play-yeoman plugin is not dist, but rather just a plain grunt call.

Whilst my Scala and sbt knowledge are next to nothing, it looks like the gruntDist definition in play-yeoman/sbt-yeoman/app/com/tuplejump/sbt/yeoman/Yeoman.scala calls runGrunt with no arguments (no 'dist' argument).

Many thanks! James

Shiti commented 8 years ago

Is your grunt task running successfully without any error? The dist task depends on the grunt task so if grunt fails, dist will not be run.

JCDClark commented 8 years ago

Yes, the grunt task executes without failure.

I currently have a 'dev' task and a 'dist' task and the default task is set to run 'dev'. If I run dev and dist individually, I can see I get an 'app' folder and 'dist' folder created respectively. If I clean both of these folders and then run 'activator dist', I can see in the output that no task is supplied to the grunt build and so it runs 'dev', which is run by default.

Once the activator has finished running, I can see an 'app' folder but no 'dist' folder.

My current workaround is to run the 'dist' task manually before performing 'activator dist'. This then picks up the output from my grunt dist build.

Thanks.

Shiti commented 8 years ago

The ui/app folder is generated through the yeoman generator and if it has been removed, grunt task will not be able to generate the required code.

Can you check if sbt dist works? If not, could you please share the code?

gleibfried commented 8 years ago

It's probably already too late, but for me "sbt dist" really executes a grunt dist if my command console is executed as administrator :)

JCDClark commented 8 years ago

Hi Shiti, many apologies - I know it's been a while. I haven't had time to look into this but am now starting to take a second look.

Thanks for the comment gleibfried, unfortunately that seems to have no effect for me.

Running sbt dist produces the same behaviour as with the activator. I therefore decided to start from scratch and create a really simple example. I first followed these instructions to create a base Play project: https://www.playframework.com/documentation/2.5.x/NewApplication

After creating the new scala seed project, I followed the instructions on your repo readme: https://github.com/tuplejump/play-yeoman/tree/v0.9.0

The activator generated a project using play 2.5.2 so I followed the instructions for play-yeoman 0.9.0. After doing so, I found that it wasn't running grunt at all during dist. To get around this, I had to add 'Yeoman.withTemplates' to the bottom of build.sbt.

Once that was done, I am seeing the same behaviour before, 'sbt dist' runs the default grunt task rather than grunt dist. What seems to be interesting this time however is that the built jar in target/universal now no longer picks up the ui/dist directory if I run 'grunt dist' manually. I therefore can't make use of this at all at the moment (running from dev works fine though - I can navigate to the resources via /ui).

I have uploaded the small project here: https://bitbucket.org/jcd_clark/playyeomandisttest

The gruntfile has two tasks: dev and dist. dev will copy a file to 'app' (sorry this was poorly named, should have been 'dev') whilst dist will copy a different file to 'dist'.

Running the grunt tasks through the sbt console works fine, including specifying dist, dev etc. It's just the dist build that doesn't seem to be running the right grunt task nor copying the files into the built play jar.

Many thanks for investigating! Apologies again for the slow response.

James

malterb commented 7 years ago

Hi,

I am running into this issue as well.

sbt dist runs Grunt sbt docker:publishLocal does not.

any idea why?