简体   繁体   English

如何在eclipse kepler中运行AngularJS?

[英]How to run AngularJS in eclipse kepler?

I'm new to Angularjs and i'm trying to run first angular program with Spring. 我是Angularjs的新手,我正在尝试使用Spring运行第一个Angular程序。 I downloaded the code from here: http://javahonk.com/spring-mvc-angularjs-integration/ . 我从这里下载了代码: http : //javahonk.com/spring-mvc-angularjs-integration/ Imported it as a maven project. 将其作为Maven项目导入。 Downloaded JSDT and AngualrJs plugin from eclipse marketplace but it's still not running. 从日食市场下载了JSDT和AngualrJs插件,但仍未运行。 There is no error message. 没有错误信息。 I'm running this on tomcat 7. What am I missing? 我正在tomcat 7上运行它。我缺少什么?

Any help would be appreciated? 任何帮助,将不胜感激?

I'm not a Eclipse user. 我不是Eclipse用户。 so I have no idea for that. 所以我对此一无所知。 But you can use nodejs as a static server. 但是您可以将nodejs用作静态服务器。 it is explained here 在这里解释

1) Install nodejs for your OS 1)为您的操作系统安装nodejs

2) Run this command in a terminal (console) 2)在终端(控制台)中运行此命令

> npm install http-server -g

3) Start server 3)启动服务器

> cd /path/to/your/project
> http-server -o --cors 

Now you can access your project from browser http://localhost:8080/yourfile.html 现在您可以从浏览器http://localhost:8080/yourfile.html访问您的项目

Work in Eclipse and just refresh page on browser to see changes. 在Eclipse中工作,只需刷新浏览器上的页面即可查看更改。

If you are working on a Spring Application within Eclipse IDE , your best alternative would be to start you appliction using an embedded Application Server (Best I would recommand are Jetty or Tomcat if you ain't need EE level components). 如果您正在Eclipse IDE中使用Spring Application,那么最好的选择是使用嵌入式Application Server启动应用程序(如果您不需要EE级别的组件,我最好建议您使用JettyTomcat )。 You can follow this link , which holds basic steps for adding a new Application Server within Eclipse IDE. 您可以单击此链接 ,其中包含在Eclipse IDE中添加新的Application Server的基本步骤。

Once you have added a new application server, you can deploy your application in it then launch it and you should have your applcation reachable at http://localhost:8080/SpringMVCAngularJS . 一旦添加了新的应用程序服务器,就可以在其中部署应用程序 ,然后启动它,并且应该可以从http://localhost:8080/SpringMVCAngularJS到达应用程序

A good alternative when using Maven as a build tool, is using an embedded AS plugin such as Tomcat7 Plugin or Jetty Plugin . 将Maven用作构建工具时,一个很好的选择是使用嵌入式AS插件,例如Tomcat7插件Jetty插件 This plugin will provide the ability to start your applcation using the Maven different goals (which does not require adding a new AS into Eclipse IDE). 此插件将提供使用Maven不同目标(无需在Eclipse IDE中添加新的AS)启动应用程序的功能。 I've pushed a sample module based on the tutorial you mentioned. 我根据您提到的教程推送了一个示例模块 YOu can test the above described plugin as follows in a *nix shell (You may need to setup git if not already done): 您可以在* nix shell中如下测试上述插件(如果尚未完成,则可能需要设置git ):

git clone https://github.com/tmarwen/stackoverflow-showcase.git
cd stackoverflow-showcase/springmvc-angularjs
mvn tomcat7:run

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM