[英]How to create project setting for Eclipse IDE of a Play Java project
I am using Eclipse 4.5 (Mars) and Play framework 2.4.我正在使用 Eclipse 4.5 (Mars) 和 Play 框架 2.4。 I created a Java project using the template id
play-java
.我使用模板 id
play-java
创建了一个 Java 项目。 Then I created Eclipse settings for the project using the command eclipse
at activator
console.然后我在
activator
控制台使用命令eclipse
为项目创建了 Eclipse 设置。 Somehow, the .project
file got changed and now Eclipse recognizes Java project as Scala project.不知何故,
.project
文件发生了变化,现在 Eclipse 将 Java 项目识别为 Scala 项目。 This means I get no Java help from Eclipse.这意味着我无法从 Eclipse 获得 Java 帮助。 This is the content of the
.project
file in the root project folder:这是根项目文件夹中
.project
文件的内容:
<projectDescription>
<name>YMLPushNotificationService</name>
<buildSpec>
<buildCommand>
<name>org.scala-ide.sdt.core.scalabuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.scala-ide.sdt.core.scalanature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources> </linkedResources>
</projectDescription>
If I manually edit the file and replace the line如果我手动编辑文件并替换该行
<name>org.scala-ide.sdt.core.scalabuilder</name>
with和
<name>org.eclipse.jdt.core.javabuilder</name>
and run the eclipse
command from activator
console, the file gets overwritten to its previous state.并从
activator
控制台运行eclipse
命令,该文件将被覆盖为其以前的状态。 How do I make eclipse recognize the project as Java project?如何让 Eclipse 将项目识别为 Java 项目?
In your project/plugins.sbt
you need a line with:在您的
project/plugins.sbt
您需要一行:
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
and in your build.sbt
the following lines:并在您的
build.sbt
中添加以下几行:
import com.typesafe.sbteclipse.core.EclipsePlugin.EclipseKeys
EclipseKeys.projectFlavor := EclipseProjectFlavor.Java // Java project. Don't expect Scala IDE
EclipseKeys.createSrc := EclipseCreateSrc.ValueSet(EclipseCreateSrc.ManagedClasses, EclipseCreateSrc.ManagedResources) // Use .class files instead of generated .scala files for views and routes
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.