我应该做什么才能与 maven + 一起工作日食 +检票口 +休眠+ Mac 操作系统中的 spring 吗?

发布于 2024-08-26 08:23:56 字数 1685 浏览 5 评论 0原文

我想创建一个使用 wicket、hibernate 和 spring 框架的 Web 应用程序。我选择的 IDE 是 Eclipse,我使用 Maven 生成 .war,并且运行 Mac OS。我应该按照什么步骤来正确安装和配置所有工具,以便运行依赖这三个框架的项目。我能够成功设置 wicket,但在设置 hibernate 和 spring 时遇到问题。我浏览了多个教程,但仍然找不到解决方案。

谢谢!

我现在将尝试解释一下我无法解决的问题是什么。我首先从一个干净的项目开始:

  1. mvn archetype:create -DgroupId=test.framework -DartifactId=microForum
  2. 移至项目文件夹并 mvn eclipse:eclipse
  3. 从 eclipse 导入项目
  4. 查看 apache wicket 主页,其中有多个示例,所以我通读了该页面,这足以了解要添加到 pom 中的内容,并且有 wicket 和一切正常运行。

我的下一步是尝试使用 hibernate 和/或 spring。我认为以与我向 pom 添加 wicket 必要的配置和依赖项(手动)相同的方式“添加”hibernate 和 spring 可能并不那么容易。所以我尝试使用maven原型:appfuse-basic-spring。所以:

  1. mvn archetype:generate ->启动向导,让您在不同的原型中进行选择

在选择原型编号 2(Hibernate + Spring + Spring MVC)后,它失败了

在谷歌搜索后,我发现了它失败的原因(就像我应该在 appfuse-basic- 之后添加一个 -archetype 一样)因此,我没有使用向导,而是输入:

  1. mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring*-archetype* -DarchetypeVersion=2.1.0-M1 -DgroupId= test.framework -DartifactId=microForum2

这创建了我的项目(在多次警告之后)。我粘贴了屏幕截图(图 1),因为某些信息可能具有一些重要含义:

http://img97.imageshack.us/img97/6687/screenshot20100323at112.png - Image 1

  1. 然后我做了 mvn eclipse:eclipse 并且它开始下载数百万个东西,这看起来很奇怪,所以我 Control+C 它。

按照 schmimd04 答案,我尝试使用 eclipse maven 插件,但无法创建 Maven 项目:

无法从原型创建项目 [org.appfuse.archetypes:appfuse-basic-spring:RELEASE] 定义的工件不是原型

谢谢!

pd:我的Mac操作系统已经安装了maven(版本2.2.0),我尝试下载最后一个并重复相同的步骤,但我仍然遇到同样的问题。

I want to create a web app that will use wicket, hibernate and spring frameworks. My IDE of choice is Eclipse, I am using maven for the .war generation and I am running Mac OS. What steps should I follow to correctly install and configure all the tools so as to have a project running that relies on these 3 frameworks. I was able to successfully set up wicket but I am having trouble for setting up hibernate and spring. I went through multiple tutorials but I still couldn't find the solution.

Thanks!

I will now try to explain a bit what is the problem I can't solve. I first began with a clean project:

  1. mvn archetype:create -DgroupId=test.framework -DartifactId=microForum
  2. Moved on to the project folder and mvn eclipse:eclipse
  3. Imported the project from eclipse
  4. Looked into the apache wicket homepage where there are multiple examples, so I read through the page and that was enough to learn what to add to the pom and had wicket and everything up and running nicely

My next step was trying to use hibernate and/or spring. I thought that "adding" hibernate and spring in the same way I added the wicket necessary configurations and dependencies to the pom (by hand) might not be that easy. So I tried using the maven archetype: appfuse-basic-spring. So:

  1. mvn archetype:generate -> launchs the wizard that lets you choose among different archetypes

After choosing the archetype number 2 ( Hibernate + Spring + Spring MVC) it fails

After googling a bit I found out why it fails (something like I should add a -archetype after appfuse-basic-spring. So, instead of using the wizard, I put:

  1. mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring*-archetype* -DarchetypeVersion=2.1.0-M1 -DgroupId=test.framework -DartifactId=microForum2

This created my project (after multiple warnings). I paste a screenshot (Image 1) because some of the information might have some important meaning :

http://img97.imageshack.us/img97/6687/screenshot20100323at112.png
- Image 1

  1. I then did mvn eclipse:eclipse and it started downloading millions of things, which seemed very odd so I Control+C it.

Following schmimd04 answer I tried to use the eclipse maven plugin but I couldn't create a maven project:

Unable to create project from archetype [org.appfuse.archetypes:appfuse-basic-spring:RELEASE]
The defined artifact is not an archetype

Thanks!

p.d: My Mac OS already had maven installed (version 2.2.0), I tried downloading the last one and repeating the same steps but I still had the same trouble.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

人海汹涌 2024-09-02 08:23:56

Bert 推荐的 LegUp,jweekend.com/dev/LegUp,对我来说效果很好。我使用了 wicket + Spring + JPA 原型。我仍然会寻找maven的Hibernate+Spring+Spring MVC原型对我不起作用的原因。一旦我得到答案,我会编辑这个。目前,legup 完成了这项工作!

谢谢

Bert's recommendation LegUp, jweekend.com/dev/LegUp, have worked just fine for me. I used the wicket + Spring + JPA archetype. I will still look for the reason why maven's Hibernate+Spring+Spring MVC archetype didn't work for me. I'll edit this once I have the answer. For the time being, legup did the job!

Thanks

满地尘埃落定 2024-09-02 08:23:56

从更新站点安装适用于 Eclipse 的 Maven 插件: http://m2eclipse.sonatype.org/update

这将允许您创建 Maven 项目(我将从快速入门原型开始)并轻松添加依赖项,例如 Hibernate、Spring 和 Wicket。

Install the Maven plugin for Eclipse from the update site: http://m2eclipse.sonatype.org/update.

This will allow you to create Maven projects (I would start with the quickstart archetype) and easily add dependencies, such as Hibernate, Spring, and Wicket.

节枝 2024-09-02 08:23:56

正如帕斯卡所说,你的问题太宽泛,难以回答。一些可能对您有帮助的提示:

  • 使用“mvn eclipse:eclipse”从 pom.xml 生成 Eclipse 项目。甚至可能有一个工作 eclipse 项目,允许将 pom.xml 作为 eclipse 项目打开。我不能说,我永远抛弃了 Eclipse。

  • spring“只是”一个需要位于类路径中的库。上面的命令将确保它存在(如果它在 pom.xml 中定义为依赖项),您需要为驻留在类路径中的 Spring 定义一个 applicationContext.xml。请参阅 Spring 文档。

  • hiberate 类似,它只是一个需要位于类路径中并且需要找到配置文件的库。其中描述了与数据库的连接。有关详细信息,请参阅 hibarnate 文档(或众多博客之一)。

如果您遇到特定问题,请描述它,以便人们可以在这里提供帮助。

伯特

As Pascal is saying, your question is to broad to answer. A few pointers that might help you:

  • use 'mvn eclipse:eclipse' to generate an Eclipse project out of your pom.xml. There might even be a working eclipse project that allows to open a pom.xml as eclipse project. I can't say, i left eclipse behind for good.

  • spring is 'just' a library that need to be in your classpath. the above command will ensure it is there (if it is defind as dependency in the pom.xml) You need to define a applicationContext.xml for Spring that resides in your classpath. See the Spring documentation for that.

  • hiberate is similar, it is just a library that needs to be in the classpath and that needs to find a config file. in there, the connection to the database is described. See the hibarnate docu (or one of the many blogs out there) for more info.

If you are stuck with a particular problem, please describe it so people can help here.

Bert

话少心凉 2024-09-02 08:23:56

我不知道这听起来是否奇怪。但这是因为您的 .metadata 中有相应工作区的架构类型数据。如果删除工作区。您可以创建新的原型。我知道删除工作空间不是一个好主意。但它仍然有效。

I don't know if it sounds odd. But it is because you have archtype data in your .metadata for respective workspace. If you delete the workspace. You can create new archtype. I know deleting worksapce is not a good idea. But still it works.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文