导入源代码(意味着Eclipse STS的日食)到intellij [英] import source code (meant for eclipse spring STS) into intellij
问题描述
如何将用于Eclipse Spring STS的spring mvc github源代码导入并运行到IntelliJ中?
How to import and run spring mvc github source code meant for Eclipse Spring STS into IntelliJ?
我做了什么:
-
已下载工作的Spring MVC项目源代码zip文件 ://github.com/simplyi/springmvc-ws?fbclid = IwAR2xKg6Oh0YHLuVJ2YEh2vt6cr1u3-4E4IzKnPMDJVc6nvI-BN6pRaPMKHQ
'导入'
don't know what configurations to pick so got a lot of errors. SO, followed this https://www.lagomframework.com/documentation/1.5.x/java/IntellijMaven.html?fbclid=IwAR3JaAw6dF2jX9k4fxxKg37j8mpNI2dNTEqupVULzLrk83G_wEtN4beNJsI
但出现错误: 错误]在存储库
BUT got error: ERROR] No plugin found for prefix 'lagom' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories
因此,我在上面的链接中放弃了本教程.
So, I'm giving up on this tutorial in above link.
这是Intellij终端错误的gyazo屏幕截图: https://gyazo.com/7f83cca2baeff6ca383885f814325477
Here is gyazo screenshot of Intellij terminal errors: https://gyazo.com/7f83cca2baeff6ca383885f814325477
此gyazo屏幕截图显示了外部库: https://gyazo.com/6e2898508b64061ebf726fc46881b0ef
This gyazo screenshot shows external libraries: https://gyazo.com/6e2898508b64061ebf726fc46881b0ef
如何将此源代码导入Intellij&运行/测试Web应用程序?
How to import this source code into Intellij & run/test the webapp?
谢谢!
推荐答案
我已经从您的链接下载并运行了Spring Boot应用程序. 它会启动并通过测试.
I've downloaded and run the Spring Boot application from your link. It starts and passes the tests.
发现您的问题是您正在运行的是什么类.
Looks that your problem is what class you're running.
- 以JUnit身份运行
\springmvc-ws\src\test\java\com\appsdeveloperblog\app
软件包以运行测试. - 将
com.appsdeveloperblog.app.ws.MobileAppWsApplication
类作为Spring Boot应用程序运行以运行该应用程序.
- Run
\springmvc-ws\src\test\java\com\appsdeveloperblog\app
package as JUnit to run the tests. - Run
com.appsdeveloperblog.app.ws.MobileAppWsApplication
class as Spring Boot application to run the application.
我为运行应用程序和测试所做的事情:
What I've done to run the application and the tests:
- 从github克隆项目:在控制台中运行
git clone https://github.com/simplyi/springmvc-ws.git
. 该项目将被克隆到您执行git clone
的位置的springmvc-ws
子目录中. - 在IDEA中,选择
File
->Open
(通过键盘: Alt + F , O ),选择克隆的springmvc-ws
文件夹. - 选择确定.如果需要,请回答以在当前窗口或新窗口中将其打开.
- 等待要导入的项目(底部状态栏中不显示任何正在运行的操作).
- Clone the project from github: run
git clone https://github.com/simplyi/springmvc-ws.git
in the console. The project will be cloned intospringmvc-ws
sub-directory of from where you executedgit clone
. - In IDEA, select
File
->Open
(from keyboard: Alt + F, O), select the clonedspringmvc-ws
folder. - Select OK. If required, answer to open it in current or new window.
- Wait for the project to be imported (no running operations displayed in the bottom status bar).
- 打开课程
MobileAppWsApplication
(您可以在 Ctrl + N 中输入它作为快速的转到课程"快捷方式). - 按 Shift + Alt + F10 .
-
使用Spring Boot图标选择执行,然后选择
Run
.请参见下面的屏幕截图.
- Open class
MobileAppWsApplication
(you can type it in Ctrl + N as a quick "Go to class" shortcut). - Press Shift + Alt + F10.
Select execution with Spring Boot icon and select
Run
. See the screenshot below.
在底部的Run
工具窗口中,您会看到该应用程序已在localhost:8080
的上下文路径/mobile-app-ws
下启动:
In Run
tool window at the bottom, you'll see that the application has started on localhost:8080
under the context-path /mobile-app-ws
:
2019-06-21 15:42:51.585 INFO 31920 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '/mobile-app-ws'
2019-06-21 15:42:51.588 INFO 31920 --- [ main] c.a.app.ws.MobileAppWsApplication : Started MobileAppWsApplication in 8.688 seconds (JVM running for 10.143)
- 在此
Run
工具窗口的Endpoints
选项卡中,您可以看到已启动应用程序的Web服务端点. - In the
Endpoints
tab of thisRun
tool window, you can see the web-service endpoints of the started application. - 如果应用程序正在运行,请停止运行(
Run
工具窗口中的红色Stop
按钮),以使其不存在冲突端口. - 在
Project
窗口( Alt + 1 )中,选择目录\springmvc-ws\src\test\java\com\appsdeveloperblog
并按 Shift + Alt + F10 . - 选择带有JUnit(箭头)图标的点,然后选择
Run
点.请参见下面的屏幕截图. -
Run
工具窗口将激活.等待测试通过.您可以展开目录以查看测试结果. - Stop the application if it is running (Red
Stop
button inRun
tool window), to not have the clashing ports. - In
Project
window (Alt + 1), select the directory\springmvc-ws\src\test\java\com\appsdeveloperblog
and press Shift + Alt + F10 on it. - Select the point with JUnit (arrows) icon on it and then select
Run
point. See the screenshot below. Run
tool window will activate. Wait for the tests to pass. You can expand the directory to see the tests results.
这篇关于导入源代码(意味着Eclipse STS的日食)到intellij的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!