Al-Mothafar Al-Mothafar - 5 months ago 163
Java Question

Play framework build dist file, or any old commands (clean compile stage) with activator 1.3.10 for windows

I'm trying to update my activator launcher for my play framework app from older versions to latest one, I was using versions from 1.3.6 to 1.3.8 without any issues with running commands like the following:

ACTIVATOR_BIN_PATH> activator clean compile stage dist


But I tried to use the latest version 1.3.10 its not working, its says something like:

ACTIVATOR_HOME=[PROJECT_PATH]\play-java
The system cannot find the file [PROJECT_PATH]\play-java\bin\..\conf\sbtconfig.txt.
Did not detect an activator project in this directory.
- activator
Load an existing project (has to be executed from the project directory)
or print this help message if no project is found

Sub-commands
- activator ui
Open the project in the UI if executed from an existing project
directory, otherwise open a project-creation UI.

- activator new [project-name] [template-name]
Create a new project, prompting for project-name if missing and helping you
find a template if template-name is not provided.

- activator list-templates
Fetch the latest template list and print it to the console.


You can donwload activators (1.3.8-minimal) and (1.3.10-minimal), for 1.3.10 donwnload (scala-sbt) and then, apply fixes provided here : Warning message running Play 2.5.2

Then you can start first project for both activators:

activator new my-first-app play-java


My plugin.sbt:

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.3")

addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "3.0.1")

addSbtPlugin("com.github.mmizutani" % "sbt-play-gulp" % "0.1.1")

Answer

For now I found some kind of solution for it, moved the activator from bin folder one step back to [PROJECT_PATH] , and changes some lines

changes valued for BIN_DIRECTORYand ACTIVATOR_HOME from:

set BIN_DIRECTORY=%~dp0
set BIN_DIRECTORY=%BIN_DIRECTORY:~0,-1%
for %%d in (%BIN_DIRECTORY%) do set ACTIVATOR_HOME=%%~dpd
set ACTIVATOR_HOME=%ACTIVATOR_HOME:~0,-1%

to:

set BIN_DIRECTORY=%~dp0
set BIN_DIRECTORY=%BIN_DIRECTORY:~0,-1%
for %%d in (%BIN_DIRECTORY%) do set ACTIVATOR_HOME=%~dp0
set ACTIVATOR_HOME=%ACTIVATOR_HOME:~0,-1%

and SBT_HOME to :

set SBT_HOME=%BIN_DIRECTORY%

and FN to :

set FN=%SBT_HOME%\conf\sbtconfig.txt

For Linux version (bash), changed sbt_home to this:

declare -r sbt_home="$(realpath "$(dirname "$(realpath "$0")")")"

And seems now its working.

Not really sure if there is a way to fix it without move the activator out of bin, since Linux version seems still working well inside bin, but the windows does not.

But this solution works for now anyway.