首页 新闻 会员 周边 捐助

idea集成maven问题

0
悬赏园豆:15 [已解决问题] 解决于 2021-02-03 03:41

如下图片中,idea右面的maven中的plugins中没有dependency,我的pom.xml中已经配置上了

maven-dependency-plugin, 不知道咋回事?? 请路过的朋友帮忙解释下。




        
梦再笑的主页 梦再笑 | 初学一级 | 园豆:55
提问于:2021-01-21 23:43
< >
分享
最佳答案
1

pom.xml写的缺少东西吧 groupId没有,这个应该有提示,看下提示信息

收获园豆:15
2012 | 高人七级 |园豆:21445 | 2021-01-22 14:32

不是的,我只是这样说明下问题,我是groupid  artifactid以及版本号,都配上了的。

梦再笑 | 园豆:55 (初学一级) | 2021-01-22 14:38

然后我就照1楼说的那样,不配排除。还是加载不出来???

梦再笑 | 园豆:55 (初学一级) | 2021-01-22 14:42

@梦再笑: 把pom.xml的文本内容贴下,确认下是环境问题还是pom编写问题

2012 | 园豆:21445 (高人七级) | 2021-01-22 14:43

@2012: 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.company</groupId>
    <artifactId>opk</artifactId>
    <packaging>jar</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <url>http://maven.apache.org</url>
    <dependencies>
        <!-- 单元测试 -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <!-- 1.日志 -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <!-- 2.数据库 -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.38</version>
        </dependency>
        <!-- DAO: MyBatis -->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.2.2</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>1.2.0</version>
        </dependency>
        <!-- 3.Servlet web -->
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- 4.Spring -->
        <!-- 4.1 Spring核心 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>3.2.13.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>3.2.13.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.2.13.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>3.2.13.RELEASE</version>
        </dependency>
        <!-- 4.2 Spring DAO层 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>3.2.13.RELEASE</version>
        </dependency>
        <!-- 通知 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>3.2.13.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.8.10</version>
        </dependency>
        <!-- 4.3 Spring web层 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>3.2.13.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>3.2.13.RELEASE</version>
        </dependency>
        <!-- 工具 -->
        <!-- dbcp连接池 -->
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>commons-pool</groupId>
            <artifactId>commons-pool</artifactId>
            <version>1.6</version>
        </dependency>
        <!-- 文件上传 -->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.1</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.1.0</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>    
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <archive>
                        <addMavenDescriptor>true</addMavenDescriptor>
                        <compress>true</compress>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <classpathLayoutType>simple</classpathLayoutType>
                            <useUniqueVersions>true</useUniqueVersions>
                            <mainClass>com.company.App</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>2.5.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.7.1</version>
            </plugin>
        </plugins>
        <finalName>opk</finalName>
    </build>
</project>
梦再笑 | 园豆:55 (初学一级) | 2021-01-22 21:05

@梦再笑: 使用idea 2019.2.3 直接导入这个pom.xml文件没有问题
导入时会提示下载依赖的jar包

你的出错的话,在pom.xml上右键 maven - Reimport 重新导入试试,只要这个完整了应该就没有问题

2012 | 园豆:21445 (高人七级) | 2021-01-25 09:55
其他回答(2)
0


setting—maven 更换个本地仓库路径试试;
还不行的话换个idea版本。idea-2019.2 测试没问题

Ctrl` | 园豆:3317 (老鸟四级) | 2021-01-22 08:55

换了个idea也不行。我导入别人的工程就可以。。。。  我的这个依赖插件配置,拷贝别人的就不行。

支持(0) 反对(0) 梦再笑 | 园豆:55 (初学一级) | 2021-01-22 10:14

@梦再笑: 把你的<plugin> 替换成
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
</plugin>

这块试试。不排除东西先

支持(0) 反对(0) Ctrl` | 园豆:3317 (老鸟四级) | 2021-01-22 10:17

@Ctrl`: 嗯,这样试过了,还是没有。

支持(0) 反对(0) 梦再笑 | 园豆:55 (初学一级) | 2021-01-22 10:37
0

版本明确记好了,自带的有问题,重新按一个maven

浅笑若风 | 园豆:245 (菜鸟二级) | 2021-01-22 09:46

我是重装了maven后又试过了的。不行。。。

支持(0) 反对(0) 梦再笑 | 园豆:55 (初学一级) | 2021-01-22 10:13
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册