[英]Please help get started with creating a simple project using eclipse, spring, maven
I was not able to use the new jar files immediately, had to do mvn install several times and finally all the jar files are showed up in the project. 我无法立即使用新的jar文件,不得不多次安装mvn,最后所有的jar文件都显示在项目中。
what could be the problem? 可能是什么问题呢? Is it not updating the class path correctly? 它不能正确更新类路径吗?
My questions are: 我的问题是:
Edit: Attached the screenshot of the repository 编辑:附加存储库的屏幕快照
Edit2: i picked the wrong project type. Edit2:我选择了错误的项目类型。 Once i picked webapp archetype, it puts all dependencies in "Maven Dependencies". 一旦我选择了webapp原型,它将所有依赖项放入“ Maven依赖关系”中。 This is related to my second question. 这与我的第二个问题有关。
For your question 3 : You can add any public maven repositories in to your pom file which contains your required jar files. 对于您的问题3:可以将任何公共Maven存储库添加到包含所需jar文件的pom文件中。
http://forum.springsource.org/showthread.php?63612-Maven-repository-location http://forum.springsource.org/showthread.php?63612-Maven-repository-location
or else if you have that jar file in your local machine you can manually install it into maven repository. 否则,如果本地计算机中有该jar文件,则可以将其手动安装到maven存储库中。
mvn install:install-file -Dfile=<path-to-file> -DgroupId=group-id
-DartifactId=artifact-id -Dversion=version -Dpackaging=packaging
As per the Guide to installing 3rd party JARs . 按照安装第三方JAR的指南 。
For your 2nd question you can use: 对于第二个问题,您可以使用:
http://maven.apache.org/plugins/maven-dependency-plugin/ http://maven.apache.org/plugins/maven-dependency-plugin/
If you are using m2eclipse, be sure to right click on the project, select Maven and then "Update project configuration". 如果您使用的是m2eclipse,请确保右键单击该项目,选择Maven,然后选择“更新项目配置”。 That should be enough. 那应该足够了。 I assume that you added the Maven project nature already. 我假设您已经添加了Maven项目性质。
After you create project use can use this command 创建项目使用后,可以使用此命令
mvn eclipse:eclipse -Dwtpversion=2.0
then install m2eclipse
from eclipse marketplace. 然后从eclipse市场安装m2eclipse
。 What I am doing generally is right click eclipse, import/import new maven project and choose my new maven project. 我通常做的是右键单击Eclipse,导入/导入新的Maven项目,然后选择我的新Maven项目。 Afer import if you dont see your jar folder under Libraries node of project tree, then right click build path/libraries/add class path and choose related folder. 导入后,如果在项目树的Libraries节点下看不到jar文件夹,则右键单击build path / libraries / add class path并选择相关文件夹。
If your library not available in current repository you can use another external repository with below tag: (jboss and java.net repos are very common) 如果您的库在当前存储库中不可用,则可以使用带有以下标记的另一个外部存储库:(jboss和java.net存储库很常见)
<repositories>
<repository>
<id>java.net2</id>
<url>https://repository.jboss.org/nexus.</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
</repositories>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.