如何理解使用idea对多模块项目进行install遇到的问题,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
此时为2019年8月22日晚上11点27分。
跟着黑马程序员关于品优购项目开发时,对pinyougou-servergoods-interface进行maven install时,出现了install失败。具体异常如下:
一、'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing.
[WARNING] [WARNING] Some problems were encountered while building the effective model for com.xxx.xxx:xxxx:jar:0.0.1-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 72, column 12 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING]
对照官网用法:http://maven.apache.org/plugins/maven-compiler-plugin/usage.html
起初配置:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> </plugins> </build> * ${java.version} 为1.8 ${project.build.sourceEncoding} 为UTF-8
该问题解决办法是需要置顶maven版本,解决办法:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> </plugins> </build>
二、Failed to execute goal on project pinyougou-sellergoods-interface: Could not resolve dependencies for project cn.pinyougou:pinyougou-sellergoods-interface:jar:1.0-SNAPSHOT: Failed to collect dependencies at cn.pinyougou:pinyougou-pojo:jar:1.0-SNAPSHOT。
分析:我的pinyougou-sellergoods-interface是依赖于pinyougou:pinyougou-pojo,已经在pinyougou-sellergoods-interface的pom.xml文件中引入了pinyougou:pinyougou-pojo的依赖,但是使用maven的install命令还是打包不了jar包。解决方案是:
将父工程使用install打包,出错是必须的。因为还有其他子模块没有设定好依赖,暂时不管;
再使用maven的clean命令将父工程清除一下;
最后对需要打包的子模块使用maven的install命令即可。
<!--spring web依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <!-- 去除内嵌tomcat --> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> <!--<scope>provided</scope>--> </dependency>
clean --- > install即可。
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。