mvn clean install intellij - 编译错误 - 找不到符号

时间:2018-06-17 05:46:40

标签: java maven apache-camel

从Intellij Idea使用Build菜单,项目成功编译, 但是当我们使用mvn clean install命令进行编译时,它会失败。这可能是什么原因? enter image description here

项目位置: enter image description here

我添加了这些库,以便在intellij中使用成功编译 项目结构 - >库 - >新项目库 - > Java

enter image description here

这就是pom.xml的外观

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.datastech.idmb.iba</groupId>
    <artifactId>idmb-test</artifactId>
    <version>3.0-SNAPSHOT</version>

    <packaging>jar</packaging>

    <description>IDMB TEST module</description>


    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>

        <datas-spring.version>1.2-SNAPSHOT</datas-spring.version>

        <!-- WEB -->
        <javax.servlet-api.version>3.1.0</javax.servlet-api.version>
    </properties>

    <dependencies>



        <!-- WEB -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${javax.servlet-api.version}</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <forceJavacCompilerUse>true</forceJavacCompilerUse>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
            </plugin>
        </plugins>
    </build>


</project>

1 个答案:

答案 0 :(得分:1)

https://mvnrepository.com/获取依赖关系pom语法 在pom.xml中添加如下 请务必在以下<version>代码

中添加合适的版本
 <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.3.10.RELEASE</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>4.3.10.RELEASE</version>
        </dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.9.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.9.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.9.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.mjeanroy/dbunit-plus -->
<dependency>
    <groupId>com.github.mjeanroy</groupId>
    <artifactId>dbunit-plus</artifactId>
    <version>0.2.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.fcrepo.camel/fcrepo-camel -->
<dependency>
    <groupId>org.fcrepo.camel</groupId>
    <artifactId>fcrepo-camel</artifactId>
    <version>4.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.dbunit/dbunit -->
<dependency>
    <groupId>org.dbunit</groupId>
    <artifactId>dbunit</artifactId>
    <version>2.4.8</version>
</dependency>
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>
 </dependencies>