本文介绍了如何在gwt-maven项目中部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 首先,我不确定我要在gwt-maven项目中部署哪些文件夹和文件我有: .gwt .settings bin src / main / java target war pom.xml 我很确定,我已经以某种方式部署了pom.xml文件和目标文件夹。但我的目标文件夹中没有包含需要在jetty服务器上部署的pom.xml。第二:我在我的web服务器上安装了maven ,但除了在pom.xml中嵌入jetty-maven-plugin(由 org.eclipse.jetty jetty-maven-plugin ) I完全不知道如何让这个项目在码头服务器上运行。 http://maven.apache.org/xsd/maven-4.0.0.xsd > 4.0.0 SiedlerVonCatanC SiedlerVonCatanC war src / main / java src / main / java * / .java maven-compiler-插件 3.1 1.7 1.7 < / plugin> < plugin> < groupId> org.codehaus.mojo< / groupId> < artifactId> gwt-maven-plugin< / artifactId> < version> 2.5.1< / version> <执行次数> <执行> <目标> < goal>编译< / goal> < goal> test< / goal> < /目标> <配置> < module> main.java.de.swp.catan.SiedlerVonCatanC< / module> < runTarget> SiedlerVonCatanC.html< / runTarget> < hostedWebapp> $ {webappDirectory}< / hostedWebapp> < / configuration> < /执行> < /执行次数> < / plugin> < plugin> < groupId> org.eclipse.jetty< / groupId> < artifactId> jetty-maven-plugin< / artifactId> < / plugin> < / plugins> < / build> <依赖关系> < dependency> < groupId> com.google.gwt< / groupId> < artifactId> gwt-servlet< / artifactId> < version> 2.5.1< / version> < /依赖关系> < dependency> < groupId> com.google.gwt< / groupId> < artifactId> gwt-user< / artifactId> < version> 2.5.1< / version> < /依赖关系> <! - SmartGWT - > < dependency> < groupId> com.smartgwt< / groupId> < artifactId> smartgwt< / artifactId> < version> 3.0< / version> < /依赖关系> <! - 事件服务 - > < dependency> < groupId> de.novanic.gwteventservice< / groupId> < artifactId> gwteventservice< / artifactId> < version> 1.2.0< / version> < /依赖关系> <! - Java-Mail - > < dependency> < groupId> javax.mail< / groupId> < artifactId>邮件< / artifactId> < version> 1.4< / version> < /依赖关系> <! - Apache Commons - > < dependency> < groupId> commons-lang< / groupId> < artifactId> commons-lang< / artifactId> < version> 2.3< / version> < /依赖关系> <! - htmlunit(wird im Projekt irgendwo genutzt) - > <! - <依赖关系> <&的groupId GT; net.sourceforge.htmlunit< /&的groupId GT; < artifactId的>&的HtmlUnit LT; / artifactId的> < version> 2.4< / version> < /依赖性> - > < dependency> < groupId> com.google.inject< / groupId> < artifactId> guice< / artifactId> < version> 3.0< / version> < /依赖关系> < dependency> < groupId> mysql< / groupId> < artifactId> mysql-connector-java< / artifactId> < version> 5.1.25< / version> < /依赖关系> < /依赖关系> < repositories> < repository> < id> com.smartgwt< / id> < url> http://www.smartclient.com/maven2< / url> < / repository> < / repositories> < version> 0.2< / version> 解决方案如果您想使用maven插件来运行嵌入式jetty进行开发,那么使用命令行(我推荐开始)的简单方法是: 编辑:请注意,这与现有项目无关,它从头开始处理。 下载gwt maven插件下载gwt maven插件 http://mojo.codehaus.org/gwt-maven-plugin/ 。在命令行列表中,您可以将它看作 org.codehaus.mojo:gwt-maven-plugin(Google Web Toolkit的Maven插件。)我看到您拥有此插件在POM中,但是如果你在这里失去了从命令行到实现这些命令的简单步骤: $ b $ ol 在搜索提示符中输入 org.codehaus.mojo:gwt-maven-plugin > mvn archetype:generate 使用回车确认resutl 根据提示设置maven项目配置 使用 mvn gwt:run 从您拥有pom.xml的文件夹运行项目 这两个步骤将为您运行一个示例项目,您可以在进一步修改和试验的同时了解它的工作方式。 至于目录: maven编译目标目录中的所有东西,用于部署或运行嵌入式jetty。 first of all, I'm not sure which folders and files i have to deploy in a gwt-maven projectI've got:.gwt.settingsbinsrc/main/javatargetwarpom.xmlI'm pretty sure, I've to deploy the pom.xml somehow and the target folder. But my target folder doesn't contain a pom.xml which I need for deploying on a jetty serverSecond:I've installed maven on my webserver, but apart from embedding the jetty-maven-plugin in the pom.xml (by org.eclipse.jetty jetty-maven-plugin)I have absolutely no clue how to get this project running on a jetty server.http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 SiedlerVonCatanC SiedlerVonCatanC war src/main/java src/main/java */.java maven-compiler-plugin 3.1 1.7 1.7 </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>gwt-maven-plugin</artifactId> <version>2.5.1</version> <executions> <execution> <goals> <goal>compile</goal> <goal>test</goal> </goals> <configuration> <module>main.java.de.swp.catan.SiedlerVonCatanC</module> <runTarget>SiedlerVonCatanC.html</runTarget> <hostedWebapp>${webappDirectory}</hostedWebapp> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> </plugin> </plugins></build><dependencies> <!-- GWT --> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-servlet</artifactId> <version>2.5.1</version> </dependency> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-user</artifactId> <version>2.5.1</version> </dependency> <!-- SmartGWT --> <dependency> <groupId>com.smartgwt</groupId> <artifactId>smartgwt</artifactId> <version>3.0</version> </dependency> <!-- Event Service --> <dependency> <groupId>de.novanic.gwteventservice</groupId> <artifactId>gwteventservice</artifactId> <version>1.2.0</version> </dependency> <!-- Java-Mail --> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4</version> </dependency> <!-- Apache Commons --> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.3</version> </dependency> <!-- htmlunit (wird im Projekt irgendwo genutzt) --> <!-- <dependency> <groupId>net.sourceforge.htmlunit</groupId> <artifactId>htmlunit</artifactId> <version>2.4</version> </dependency> --> <!-- Guice --> <dependency> <groupId>com.google.inject</groupId> <artifactId>guice</artifactId> <version>3.0</version> </dependency> <!-- Connector for JDBC --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.25</version> </dependency></dependencies><repositories> <repository> <id>com.smartgwt</id> <url>http://www.smartclient.com/maven2</url> </repository></repositories><version>0.2</version> 解决方案 If you want to use maven plugin to run embedded jetty for development then easy way using command-line (which I recommend for start) is:Edit: Please note this is not related to the existing project.Its process from scratch. Just run these command from a new directory where you would like a new gwt project to be created.Dowload gwt maven plugin http://mojo.codehaus.org/gwt-maven-plugin/. In command line list you can see it as org.codehaus.mojo:gwt-maven-plugin (Maven plugin for the Google Web Toolkit.) I see that you have this plugin in POM, but if you are at loss here the simple steps from command-line to achive this are:mvn archetype:generateenter org.codehaus.mojo:gwt-maven-plugin in search promptcomfirm the resutl with enterset-up the maven project configuration as promptedrun the project with mvn gwt:run from the folder where you have pom.xmlThese two steps will run a sample project for you which you can further modify and experiment while learning how it works.,As for directories:The maven compiles all your stuff in target directory and that is used for deployment or running embedded jetty. 这篇关于如何在gwt-maven项目中部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-15 18:41