如何在Eclipse中正确设置由appfuse创建的多模块SpringMVC应用程序?

时间:2022-11-21 00:13:42

I am trying to setup a multi module SpringMVC appfuse applicaiton in Eclipse but it seems that I'm facing lots of errors in Eclipse after I import the project in Eclipse. Can anyone please help me with a step by step guideline showing the ideal way to setup such application in Eclipse?

我正在尝试在Eclipse中设置一个多模块SpringMVC appfuse应用程序但是我在Eclipse中导入项目后似乎面临着很多错误。任何人都可以帮我一步一步的指导方针,展示在Eclipse中设置此类应用程序的理想方法吗?

4 个解决方案

#1


4  

Have you tried using maven eclipse plugin? You can just go to the project root folder (the one that contains your pom.xml file) and run "mvn eclipse:eclipse" from the command line.

你尝试过使用maven eclipse插件吗?您可以转到项目根文件夹(包含您的pom.xml文件的文件夹)并从命令行运行“mvn eclipse:eclipse”。

This will build project files for each of your modules and also create inter-dependencies. You can just treat your multi-module project like a workspace with multiple projects.

这将为每个模块构建项目文件,并创建相互依赖关系。您可以将多模块项目视为具有多个项目的工作区。

Most of the errors that appear at load time, after mvn eclipse:eclipse are because of the repository variable. You can configure this by using "mvn -Declipse.workspace= eclipse:add-maven-repo".

在mvn eclipse:eclipse之后加载时出现的大多数错误都是因为存储库变量。您可以使用“mvn -Declipse.workspace = eclipse:add-maven-repo”进行配置。

More info on maven eclipse plugin at http://maven.apache.org/plugins/maven-eclipse-plugin/.

有关maven eclipse插件的更多信息,请访问http://maven.apache.org/plugins/maven-eclipse-plugin/。

Regards, Bogdan

#2


0  

What are the errors? The most common problem I can think of is library errors, in which case you have to edit the build path.

有什么错误?我能想到的最常见的问题是库错误,在这种情况下你必须编辑构建路径。

#3


0  

From what I recall for multi-module projects, eclipse just does not handle this well. It would help to see the specific errors you're getting, and then to start from there.

从我记得的多模块项目来看,eclipse并没有很好地处理这个问题。这将有助于查看您获得的具体错误,然后从那里开始。

#4


0  

I know this problem, it's not related to Appfuse but rather to Maven itself. I suggest to follow these steps:

我知道这个问题,它与Appfuse无关,而是与Maven本身有关。我建议按照以下步骤操作:

  • set up your project;
  • 建立你的项目;

  • create every directory/source needed: mainly java sources and resources files, for both application AND unit tests;
  • 创建所需的每个目录/源:主要是java源和资源文件,用于应用程序和单元测试;

  • make sure everything compiles and all tests pass. for this you can check with

    确保编译所有内容并通过所有测试。为此您可以查看

    mvn package

  • use the eclipse maven plugin:

    使用eclipse maven插件:

    mvn eclipse:eclipse

This way the project will include everything that's needed in the classpath: Spring and Log4j configuration files, resources, etc.

这样项目将包含类路径中所需的所有内容:Spring和Log4j配置文件,资源等。

If you already executed the mvn eclipse:eclipse command, just delete the project from Eclipse (DON'T DELETE FILES!), remove Eclipse-specific files from directory, re-run mvn eclipse:eclipse

如果你已经执行了mvn eclipse:eclipse命令,只需从Eclipse中删除项目(不要删除文件!),从目录中删除特定于Eclipse的文件,重新运行mvn eclipse:eclipse

My 2 cents

我的2美分

#1


4  

Have you tried using maven eclipse plugin? You can just go to the project root folder (the one that contains your pom.xml file) and run "mvn eclipse:eclipse" from the command line.

你尝试过使用maven eclipse插件吗?您可以转到项目根文件夹(包含您的pom.xml文件的文件夹)并从命令行运行“mvn eclipse:eclipse”。

This will build project files for each of your modules and also create inter-dependencies. You can just treat your multi-module project like a workspace with multiple projects.

这将为每个模块构建项目文件,并创建相互依赖关系。您可以将多模块项目视为具有多个项目的工作区。

Most of the errors that appear at load time, after mvn eclipse:eclipse are because of the repository variable. You can configure this by using "mvn -Declipse.workspace= eclipse:add-maven-repo".

在mvn eclipse:eclipse之后加载时出现的大多数错误都是因为存储库变量。您可以使用“mvn -Declipse.workspace = eclipse:add-maven-repo”进行配置。

More info on maven eclipse plugin at http://maven.apache.org/plugins/maven-eclipse-plugin/.

有关maven eclipse插件的更多信息,请访问http://maven.apache.org/plugins/maven-eclipse-plugin/。

Regards, Bogdan

#2


0  

What are the errors? The most common problem I can think of is library errors, in which case you have to edit the build path.

有什么错误?我能想到的最常见的问题是库错误,在这种情况下你必须编辑构建路径。

#3


0  

From what I recall for multi-module projects, eclipse just does not handle this well. It would help to see the specific errors you're getting, and then to start from there.

从我记得的多模块项目来看,eclipse并没有很好地处理这个问题。这将有助于查看您获得的具体错误,然后从那里开始。

#4


0  

I know this problem, it's not related to Appfuse but rather to Maven itself. I suggest to follow these steps:

我知道这个问题,它与Appfuse无关,而是与Maven本身有关。我建议按照以下步骤操作:

  • set up your project;
  • 建立你的项目;

  • create every directory/source needed: mainly java sources and resources files, for both application AND unit tests;
  • 创建所需的每个目录/源:主要是java源和资源文件,用于应用程序和单元测试;

  • make sure everything compiles and all tests pass. for this you can check with

    确保编译所有内容并通过所有测试。为此您可以查看

    mvn package

  • use the eclipse maven plugin:

    使用eclipse maven插件:

    mvn eclipse:eclipse

This way the project will include everything that's needed in the classpath: Spring and Log4j configuration files, resources, etc.

这样项目将包含类路径中所需的所有内容:Spring和Log4j配置文件,资源等。

If you already executed the mvn eclipse:eclipse command, just delete the project from Eclipse (DON'T DELETE FILES!), remove Eclipse-specific files from directory, re-run mvn eclipse:eclipse

如果你已经执行了mvn eclipse:eclipse命令,只需从Eclipse中删除项目(不要删除文件!),从目录中删除特定于Eclipse的文件,重新运行mvn eclipse:eclipse

My 2 cents

我的2美分