maven构建项目过程中遇到的问题

一、Cannot change version of project facet Dynamic Web Module to 3.0 

手动修改:进入项目所在目录->.settings->org.eclipse.wst.common.project.facet.core.xml

二、One or more constraints have not been satisfied 

在pom.xml文件中添加 jdk1.8限制配置,然后在项目上右键->Maven->Update Project

<profiles>
     <profile>
          <id>jdk-1.8</id>
          <activation>
              <activeByDefault>true</activeByDefault>
              <jdk>1.8</jdk>
          </activation>
          <properties>
              <maven.compiler.source>1.8</maven.compiler.source>
              <maven.compiler.target>1.8</maven.compiler.target>
              <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
          </properties>
     </profile>
</profiles>

三、Cannot update project configuration -> Preference code "org.eclipse.wst.validation" has been removed  重启eclipse

四、Could not resolve dependencies for project  父级项目maven install

五、Unknown lifecycle phase "mvn"  :compile tomcat7:deploy 解决办法

六、pom.xml配置repository不生效

如下,添加了cloudera仓库,用来下载hadoop相关依赖,但是maven仍然从aliyun仓库中下载:

<repositories>
  		<repository>
			<id>cloudera</id>
			<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
		</repository>		
  </repositories>

构建日志:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building mapreduce 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.hadoop:hadoop-common:jar:2.5.0-cdh5.2.1 is missing, no
 dependency information available
[WARNING] The POM for org.apache.hadoop:hadoop-mapreduce-client-common:jar:2.5.0-cdh5.2.1 
is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.307 s
[INFO] Finished at: 2018-08-29T15:22:31+08:00
[INFO] Final Memory: 8M/385M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project mapreduce: Could not resolve dependencies for 
project com.xxx.bigdata:mapreduce:jar:0.0.1-SNAPSHOT: The following artifacts could not 
be resolved: org.apache.hadoop:hadoop-common:jar:2.5.0-cdh5.2.1, 
org.apache.hadoop:hadoop-mapreduce-client-common:jar:2.5.0-cdh5.2.1: Failure to find 
org.apache.hadoop:hadoop-common:jar:2.5.0-cdh5.2.1 in 
http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, 
resolution will not be reattempted until the update interval of nexus-aliyun has elapsed 
or updates are forced -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

maven仓库会默认所有的依赖均从配置的远程仓库下载,可以修改一个参数mirrorOf:

这里的意思是,一切依赖,如果本地没有,从aliyun仓库下载,除了getui-nexus和cloudera,这样再次对项目进行构建就会发现自定义的repository生效了。

七、切换maven源从私服切换到阿里云之后,一些本地的jar明明在maven依赖中,但是仍然显示missing artifact:

可以考虑将本地jar文件放入项目根路径下libs目录,然后增加scope和systemPath参数,将依赖加入到maven依赖路径下,

配置如下:

<dependency>
	<groupId>com.jetty</groupId>
	<artifactId>jetty-continuation-7.6.2.v20120308</artifactId>
	<version>1.0.1</version>
	<scope>system</scope>
	<systemPath>${project.basedir}/libs/jetty-continuation-7.6.2.v20120308-1.0.1.jar</systemPath>
</dependency>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

luffy5459

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值