Open PhilipRoman opened 4 years ago
I like the idea with mvn example! :)
1、 update pom.xml line 166:
After pom.xml was changed, directly mvn clean install , it would fail with follow message:
[ERROR] Failed to execute goal biz.aQute.bnd:bnd-maven-plugin:4.3.1:bnd-process (default) on project Java-WebSocket: The default package '.' is not permitted by the Import-Package syntax.
2、 add package to the java of example : mvn clean install , it was successful. And the classes ware in the dir of example: Ex : https://github.com/dota17/Java-WebSocket/pull/15 This is just an example how I use it, I hope it can help you.
3、 Add the dependency of slf4j-api-1.7.25 in the libs: /c/code/local/Java-WebSocket/libs abc@desktop MINGW64 /c/code/local/Java-WebSocket/libs (exampleBuild) $ ls -lrt total 60 -rw-r--r-- 1 abc 197121 41203 2月 11 2020 slf4j-api-1.7.25.jar -rw-r--r-- 1 abc 197121 15257 6月 28 16:11 slf4j-simple-1.7.25.jar
4、 We can run the example with java: cd target/classes/
$ /c/code/local/Java-WebSocket/target/classes (exampleBuild) java -Djava.ext.dirs=/c/code/local/Java-WebSocket/libs example.ChatServer
5、The return result : ChatServer started on port: 8887 Server started!
I was looking for an alternative to the chat server instructions (https://tootallnate.github.io/Java-WebSocket/) mentioned in #937.
Apparently, running the examples used to be as simple as this:
When I tried building it now using Maven or Gradle, the classes under
src/main/example/
weren't being compiled so I had to manuallyjavac
them and then download SLF4J dependency jars.Maybe there should be a simple build task so you can do, for example
gradle example
ormvn example
to run the examples.