java jersey_创建一个入门的JAVA WEB站点(REST JERSEY)

最近一直在看TOMCAT,想要自己创建一个小WEB站点,有不想要部署在其他的容器内这是一个不错的学习对象。

一、选择合适的模版

mvn archetype:generate -DarchetypeCatalog=http://download.java.net/maven/2

二、选择模版

[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)

Choose archetype:

1: http://download.java.net/maven/2 -> com.sun.jersey.archetypes:jersey-quickstart-grizzly (Archetype for creating a RESTful web application with Jersey and Grizzly)

2: http://download.java.net/maven/2 -> com.sun.jersey.archetypes:jersey-quickstart-grizzly2 (Archetype for creating a RESTful web application with Jersey and Grizzly 2.x)

3: http://download.java.net/maven/2 -> com.sun.jersey.archetypes:jersey-quickstart-webapp (Archetype for creating a Jersey based RESTful web application with WAR packaging)

4: http://download.java.net/maven/2 -> com.sun.jersey.archetypes:jersey-quickstart-ejb (Archetype for creating a Jersey based RESTful EJB application with WAR packaging)

5: http://download.java.net/maven/2 -> com.sun.faces:simple-jsf (Archetype for creating a simple JSF project)

6: http://download.java.net/maven/2 -> com.sun.faces.regression:i_jsf_XXXX-archetype (Archetype for mojarra JSF regression tests)

三、填入信息

Define value for property 'groupId': : com.esri

Define value for property 'artifactId': : carrier

Define value for property 'version': 1.0-SNAPSHOT: :

Define value for property 'package': com.esri: :

Confirm properties configuration:

groupId: com.esri

artifactId: carrier

version: 1.0-SNAPSHOT

package: com.esri

Y: : y

四、进入目录,编译

$ cd carrier

$ mvn clean package

五、执行程序: mvn exec:java

$ mvn exec:java

[INFO] Scanning for projects...

[WARNING]

[WARNING] Some problems were encountered while building the effective model for com.taobao:carrier:jar:1.0-SNAPSHOT

[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 63, column 21

[WARNING]

[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.

[WARNING]

[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

[WARNING]

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] Building carrier 1.0-SNAPSHOT

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] >>> exec-maven-plugin:1.1:java (default-cli) @ carrier >>>

[INFO]

[INFO]<<< exec-maven-plugin:1.1:java (default-cli) @ carrier <<<

[INFO]

[INFO] --- exec-maven-plugin:1.1:java (default-cli) @ carrier ---

Starting grizzly...

2013-8-14 15:30:05 com.sun.grizzly.Controller logVersion

信息: GRIZZLY0001: Starting Grizzly Framework 1.9.31 - 13-8-14 下午3:30

Jersey app started with WADL available at http://localhost:9998/application.wadl

Hit enter to stop it...

六、测试结果,访问:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值