海滨擎蟹

maven错误集锦

1.maven从本地库引入依赖包,编译报错找不到类:

首先pom.xml中添加依赖

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
        </dependency>
        <dependency>
            <groupId>com.imooc.maven01</groupId>
            <artifactId>maven01-model</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
    </dependencies>

之后在maven01-model项目下提交jar包到本地库:mvn install。再次编译mvn comile,ok。

引入类需为公共的,及访问修饰符为public

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »