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

can sbt-native-packager be used to pack /test ? #1136

Closed
andreabisello opened this issue Jul 4, 2018 · 2 comments
Closed

can sbt-native-packager be used to pack /test ? #1136

andreabisello opened this issue Jul 4, 2018 · 2 comments

Comments

@andreabisello
Copy link

I'm developing a suite of test that use scalatest as testing framework.

Normally, /test cover software developed in /src folder , but in this case, there is any software. There are only tests.

In /src there are some utility classes.

The project is sbt related.

I would to pack the project in order to create a docker image to put on aws ec2 to be able to run test on the cloud.

can sbt-native-packager be used to pack test?

thanks.

@muuki88
Copy link
Contributor

muuki88 commented Jul 4, 2018

Sure. There are multiple ways to do this.

First you could simply add the sourceDirectories in Test to the sourceDirectories in Compile.

Or you can write your tests directly in the source directory. After all if your package runs tests, than these are the source files.

Last option could be to add the packageBin in Test to univeral:mappings.

What you should do in all cases is specify a mainClass ( either in Compile or in Test, depending on the solution you choose ). The main class would be the scalatest main class.

@muuki88 muuki88 closed this as completed Jul 4, 2018
@andreabisello
Copy link
Author

@muuki88 thanks for the tips.

i choose the solution to add sourceDirectories in Test and maintain the actual file structure.

i modified build.sbt adding

scalaSource in Compile := baseDirectory.value / "test"

but this change the package (my package is qa. , and code is not able to find other classes in qa. anymore) so i tried with

unmanagedSourceDirectories in Compile += baseDirectory.value / "test"

that don't break the code. it is right?

i don't understand what you are suggesting me about the test main class. i don't have any main class in the test, because every single class can be runned alone in order to cover a test.

image

can you give me other helps about the main class?

thanks.

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

No branches or pull requests

2 participants