gpt4 book ai didi

java - 使用maven制作webapp的问题

转载 作者:行者123 更新时间:2023-12-01 19:17:43 25 4
gpt4 key购买 nike

实际上,我正在命令行中使用 maven 制作一个网络项目。

mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion=1.0 -DgroupOd=ar.com -DartifactId=RETOP

然后我写 mvn -Dwtpversion=2.0 eclipse:eclipse1)在项目中,当我导入时,我没有看到文件夹 src/main/java 为什么没有?

2)Eclipse 不接受我的 M2_REPO 变量(在另一个工作区中它可以工作)我已经添加了变量和 jar。

3) 描述资源路径位置类型Java 编译器级别与已安装的 Java 项目方面的版本不匹配。 PropiedadesArg 未知分面项目问题(Java 版本不匹配)

谢谢

最佳答案

2) the eclipse not take me M2_REPO variable (in another workspace it works) I have added the variable and the jar.

对于每个工作区,您需要调用 mvn eclipse:configure-workspace 一次。这会初始化 M2_REPO变量。

3) Description Resource Path Location Type Java compiler level does not match the version of the installed Java project facet. PropiedadesArg Unknown Faceted Project Problem (Java Version Mismatch)

编译级别取自maven编译器插件的pom配置。

示例(1.6 合规性):

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<小时/>

但除此之外:mvn eclipse:eclipse不应再使用,m2eclipse是 Eclipse + Maven 的最佳选择。它使用嵌入式 Maven 安装在 Eclipse 中实际运行 Maven 构建(或其部分),而 Maven Eclipse 插件仅从外部配置 Eclipse。这是 thread were the Maven founders discuss this topic .

<小时/>

另外:

mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes
-DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion=1.0
-DgroupOd=ar.com -DartifactId=RETOP
^^^^^^^

这里有一个错字,是 groupId ,不是groupOd

<小时/>

哦,现在我明白了。 eclipse:eclipse使用变量MAVEN_REPO ,不是M2_REPO ( M2_REPO 由 m2eclipse 创建和维护)。无论如何,在 Eclipse 中,选择 Window > Preferences > Java > Build Path > Classpath Variables ,添加或编辑 M2_REPO变量并将其设置为 <path to your home directory>/.m2/repository ,例如C://users/yournamehere/.m2/repository

关于java - 使用maven制作webapp的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5884486/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com