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

eclipse project file generator #319

Open
jpercent opened this issue Jul 14, 2016 · 2 comments
Open

eclipse project file generator #319

jpercent opened this issue Jul 14, 2016 · 2 comments

Comments

@jpercent
Copy link

Hey,

I was having problems generating my eclipse project files for an existing project. I entered into sbt and typed eclipse as follows:

$ sbt
[info] Loading global plugins from C:\Users\jpercent.sbt\0.13\plugins
[info] Loading project definition from C:\Users\jpercent\code\mosaiq-platform\project
[info] Set current project to mosaiq-platform (in build file:/C:/Users/jpercent/code/mosaiq-platform/)

eclipse

It replaced sub projects names that include a dash '-' with an underscore '_' in the .classpath files, and the project could not build in eclipse. Is there a work around for this? I don't want to have to edit the sub projects every time.

I'm running SBT Eclipse version /.sbt/0.13/p

@jpercent
Copy link
Author

I gathered all the data I could, see below. Any help is greatly appreciated.

It names the .project using the variable name given in build.sbt, but it doesn't use the correct path, which is also given.

I'll walk through an example. The path to the project:
code/mosaiq-platform/common-play/

The .project name:
$ cat .project

common_play

The build.sbt line:
lazy val common_play = project.in(file("common-play"))
.settings(commonSettings: __)
.settings(commonPlaySettings: __)
.enablePlugins(PlayScala)
.settings(libraryDependencies ++= (commonLibs ++ playLibs))
.settings(publish := {})
.settings(publish in Docker := {})
.settings(publishLocal in Docker := {})
.dependsOn(common % "test->test;compile->compile")

How it's used in dependencies:
lazy val data_manager = project.in(file("data-manager"))
.settings(commonSettings: __)
.settings(commonPlaySettings: __)
.settings(dockerSettings: _*)
.settings(dockerCommands ++= Seq(
ExecCmd("ENTRYPOINT", s"bin/${project.id}"),
ExecCmd("CMD", "-Dhttp.port=9003")
))
.settings(dockerExposedPorts in Docker := Seq(9003))
.settings(libraryDependencies ++= (commonLibs ++ playLibs ++ dataMgrLibs))
.enablePlugins(PlayScala)
.dependsOn(common % "test->test;compile->compile")
.dependsOn(common_play)
.dependsOn(guid_service % "test->test")
.dependsOn(iqData % "test->test;compile->compile")
//.dependsOn(coreAuthData % "test->test;compile->compile")

The .classpath in dependencies looks as follows:
<classpathentry kind="src" path="/common_play"

But here it should use the file path and not the project name, which is different.

@jpercent
Copy link
Author

jpercent commented Jul 18, 2016

Just reposting this a bit cleaner. I'm not deleting the other one however.

Gathered a bit more information. Seems like SBT is using the variable name from build.sbt rather than the file path. A complete example follows. The subproject home/common-play is defined as follows in build.sbt:
`lazy val common_play = project.in(file("common-play"))
.settings(commonSettings: __)
.settings(commonPlaySettings: __)
.enablePlugins(PlayScala)
.settings(libraryDependencies ++= (commonLibs ++ playLibs))
.settings(publish := {})
.settings(publish in Docker := {})
.settings(publishLocal in Docker := {})
.dependsOn(common % "test->test;compile->compile")

`

Note: the value name is common_play, but file path is common-play.

It is subsequently defined as dependency as follows:

lazy val data_manager = project.in(file("data-manager"))
.dependsOn(common_play)
`

In the generated project file the name matches the variable name:
<projectDescription> <name>common_play</name> <buildSpec> <buildCommand>

In a dependency .classpath file, under a src refereence the path is listed by the build.sbt variable name:
<classpathentry kind="src" path="/common_play" exported="true" combineaccessrules="false"/>
Eclipse tries to find the directory common_play and fails.

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

1 participant