I have a little problem in Eclipse with a package . The error output is Package (name of package ) does not exist .
I have a package called de.baimos.blueid.lockserver.demo.exec . But Eclipse is looking for a package called de.baimos.blueid.lockserver.api.exec . This package is can be found in my Project nowhere .
My current situation is this: I have two projects that work as a project. Now you can in Eclipse under Properties - Add a project to a different > Project -> Java Build Path . But if I want to run Maven install I get the error above. At first I thought it would be in the pom.xml file . But I noticed that it is not possible to merge two pom.xml files. My project was to make the inheritance , however, by themselves , whom I put them together leads . Did anyone of you ever such a problem , or can someone help me ?
Thanks in advance for your help .
That is the error:
[ERROR] /home/test/workspace/HeartbeatService/src/main/java/de/baimos/blueid/lockserver/demo/exec/DemoCommandExecutionEventListener.java:[3,44] error: package de.baimos.blueid.lockserver.api.event does not exist
[ERROR] /home/test/workspace/HeartbeatService/src/main/java/de/baimos/blueid/lockserver/demo/exec/DemoCommandExecutionEventListener.java:[4,44] error: package de.baimos.blueid.lockserver.api.event does not exist
[ERROR] /home/test/workspace/HeartbeatService/src/main/java/de/baimos/blueid/lockserver/demo/exec/DemoCommandExecutionEventListener.java:[5,44] error: package de.baimos.blueid.lockserver.api.event does not exist
[ERROR] /home/test/workspace/HeartbeatService/src/main/java/de/baimos/blueid/lockserver/demo/exec/DemoCommandExecutionEventListener.java:[6,44] error: package de.baimos.blueid.lockserver.api.event does not exist
[ERROR] /home/test/workspace/HeartbeatService/src/main/java/de/baimos/blueid/lockserver/demo/exec/DemoCommandExecutionEventListener.java:[8,59] error: cannot find symbol
Maven can't see what you specify in Eclipse's Java Build Path; it's a command line tool that runs outside / without Eclipse.
Instead, you have to do mvn install in the first project.
Then you can add a dependency to this project in the second project's POM.
Maven will then make sure that Eclipse add the first project to the classpath as well without manually changing the build path in the UI.
Related
By executing a mvn clean package I see a strange maven output:
[ERROR] /home/user/Desktop/mycompany/myapp/server/src/main/java/com/mycompany/myapp/representation/rest/RestControllerAdvice.java:[8,38] error: cannot find symbol
[ERROR] symbol: class InvalidPropertyValueException
[ERROR] location: package com.mycompany.myapp.exception
So, I searched the row nr. 8 in that class and I found this one
import org.springframework.web.bind.annotation.ExceptionHandler;
But, the line which is referred to InvalidPropertyValueException is 2 rows before:
import com.mycompany.myapp.exception.InvalidPropertyValueException;
And, the strange thing, in the package com.mycompany.myapp.exception I didn't found any class or file named InvalidPropertyValueException. But Eclipse accept it and present me in the option list. And this class don't generate any error or red line.
Try maven->update project this error may go out.
On Project Explorer, right-click on the parent module
select maven, then select Update Project
I have a problem with imports in Eclipse. I have following exceptions:
[ERROR] .../ctc/wstx/io/ReaderSource.java:[9,24] package com.ctc.wstx.api does not exist
[ERROR] .../ctc/wstx/io/ReaderSource.java:[10,24] package com.ctc.wstx.exc does not exist
I use Maven, and I think I have the correct dependencies. In Maven the depedencies exist in the correct jar:
woodstox-core-asl-4.1.1.jar
- com.ctc.wstx.api
- CommonConfig.class
- EmptyElementHandler.class
- InvalidCharHandler.class
- ReaderConfig.class
- ValidatorConfig.class
- WriterConfig.class
- WstxInputProperties.class
- WstxOutputProperties.class
com.ctc.wstx.exc
also exists. If I remove imports I can use Eclipse (ctrl + 1) to import, so Eclipse sees that jar. Why do I have this problem? And how I can resolve this?
Check the path of your package and output file,I have met this problem past, it probably be resolved in the menu of configure buid path
I'm using Play 2.4 (Java version) but I'm also interested in solutions for >2.4. This is my problem. I want to structure the content of my template folder under app/views. So I'd like to create some sub packages under app/views but get compilation errors. Here is, what I've tried so far:
Create new subpackage via eclipse
app/views/mediaViewers
Put a template standardViewer.scala.html in it
app/views/mediaViewers/standardViewer.scala.html
Try to access the template from controller class via
views.mediaViewers.html.standardViewer.render()
Rebuild play project
activator clean; activator clean-files; activator run
When calling the appropriate route I get:
[error] .../Viewers.java:18: package views.mediaViewers.html does not exist
[error] views.mediaViewers.html.standardViewer
[error] ..../Viewers.java:21: package views.mediaViewers.html does not exist
[error] views.mediaViewers.html.standardViewer
[error] .../app/controllers/Viewers.java:24: package views.mediaViewers.html does not exist
...
[error] (compile:compileIncremental) javac returned nonzero exit code
[error] application -
! #765kicfe1 - Internal server error, for (GET) [/] ->
play.sbt.PlayExceptions$CompilationException: Compilation error[package views.mediaViewers.html does not exist]
...
In order to call a view template from the controller you should alwayes prefix the name of the view with "views.html", so the call to standardViewer.scala.html would be :
views.html.mediaViewers.standardViewer
you can verify this if you took a look at the generated files under target/scala-/twirl as indicated in this picture :
project structure
The package path in the controller is wrong! Use this pattern:
`views.html.your-package-goes-here.your-template-goes-here.render()`
Or more concrete:
Try to access the template from controller class via
views.mediaViewers.html.standardViewer.render()
Has to be:
views.html.mediaViewers.standardViewer.render()
I'm getting a dependency issue with a jar I'm attempting to use.
I receive the following error
remote: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project sparq: Compilation failure: Compilation failure:
remote: [ERROR] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/ServerQuery.java:[3,0] error: package com.github.koraktor.steamcondenser does not exist
remote: [ERROR] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/ServerQuery.java:[8,8] error: cannot find symbol
remote: [ERROR] class ServerQuery
remote: [ERROR] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/ServerQuery.java:[8,34] error: cannot find symbol
Here is the offending java file.
package helpers;
import com.github.koraktor.steamcondenser.*;
public class ServerQuery {
public static String getPlayers() {
SourceServer server = new SourceServer("66.150.155.152",27015);
server.initialize();
return server.toString();
}
}
I've added the following dependency to my pom.xml
<dependency>
<groupId>com.github.koraktor</groupId>
<artifactId>steam-condenser</artifactId>
<version>1.3.9</version>
</dependency>
I've also added the following action_hook pre_build script
mvn install:install-file -Dfile=./app-root/repo/steam-condenser.jar -DgroupId=com.github.koraktor -DartifactId=steam-condenser -Dversion=1.3.9 -Dpackaging=jar
Here's the GitHub for the project
https://github.com/koraktor/steam-condenser-java
And the website for it
http://koraktor.de/steam-condenser/usage/
Any ideas? Completely lost. Help much appreciated.
Since you are including the jar file in your project already, trying to manage the dependency with Maven seems like overkill. You should be able to put the jar file in your project's lib directory like this article describes. Then you won't need to configure that dependency in Maven at all.
I would use Maven for any dependencies that you want to download at the time your application is being built. Any jar files that you are checking into your project shouldn't need to be configured in Maven.
Just by looking at the question and the excerpts provided, I believe you are struggling with the basics of Maven. If I understand the situation correctly you have a library (which is not written by you):
once added to your project as a Maven dependency. This seems reasonable if you want to use it.
once the source code of the library incorrectly added to your own Java project.
remote: [ERROR] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/ServerQuery.java:[3,0] error: package com.github.koraktor.steamcondenser does not exist
Based on the errormessage above it seems you have copied one of the sourcefiles from the library into your project. This is now causing problems. The main one is that without your source-folder (src/main/java) correctly representing the package structure declared in the source file (com.github...) it cannot be compiled. Hence the errormessage:
package com.github.koraktor.steamcondenser does not exist.
First of all you need to remove this copy-pasted file entirely an just use the dependency-management feature of Maven to get the library on classpath. After that just follow the examples given by the author of the library using the link you have already found (http://koraktor.de/steam-condenser/usage/).
I'm a rookie developer trying to run an application using play framework. I've followed the tutorial and can successfully create a new project.
However when I go to the directory that has the project I'm supposed to work on and enter the play command I get the following error:
[error] Not a valid command: play (similar: last, alias, loadp)
[error] Not a valid project ID: play
[error] Not a valid configuration: play
[error] Not a valid key: play (similar: clean)
[error] play
I have very little knowledge regarding the framework and don't know where to start correcting my mistake. Any suggestions ?
You have to run the play command this way:
./play cmd [app_path] [--options]
where in case of running a project, it is
./play run /path/to/projectname
I am facing this problem in the context of sub projects.
This is what worked for me.
Code:
import sbt._
import sbt.Keys._
object ApplicationBuild extends Build {
val helloWorldProj = Project(id = "HelloWorld", base = file("helloworld"))
val appName = "WebApp"
val appVersion = "1.0"
val appDependencies = Seq()
val webAppProj = PlayProject( appName, appVersion, appDependencies, path = file("webapp"), mainLang = PlayProject.SCALA)
.dependsOn(helloWorldProj)
.aggregate(helloWorldProj)
}
On running the play command, I get the following error:
Error:
[info] Set current project to HelloWorld (in build file:/D:/EclipseProjects/HelloWorldPlayMultiProject/)
[error] Not a valid command: play (similar: last, alias, loadp)
[error] Not a valid project ID: play
[error] Not a valid configuration: play
[error] Not a valid key: play (similar: play-hash, play-dist, play-conf)
[error] play
[error] ^
Solution:
Now, if I rename helloWorldProj as zhelloWorldProj, it works!
In this case, play sets the active project to WebApp.(Since webAppProj variable name alphabetically comes before zhelloWorldProj)
I can then change the active project to HelloWorld by giving the command project HelloWorld.
I think this has something to do with how sbt finds the Project objects using reflection.
Need to have more detail about your environment (OS, Play version etc) but if you are getting errors that play is not a valid command, my first course of action would be to check that the path to play.sh (I assume you are using non-windows) is included in your system path?
I delete all directories in the project folder and it works. Do not delete files (build.properties, Build.scala and plugins.sbt)
The problem was the version difference of play. The project I was suppose to work on was developed in play 1.2 where as I installed the version 2.0 .
By the way, working with 2.0 on a project developed by version 1.2 is possible, but I strongly recommend not to do it that way as there are problems on the later stages as well.
Depending on the language you're using, make sure one of the following is in your build.sbt file:
play.Project.playJavaSettings
play.Project.playScalaSettings
I also got the same problem! What happened was in my /user/xxx/project folder there were old projects from 1.x version. Deleting that folder worked for me!