从pom.xml上的属性文件导入库时出错

时间:2017-11-24 07:04:48

标签: maven java-ee intellij-idea pom.xml maven-plugin

我正在尝试将我的版本从pom.xml移动到属性文件,但是在执行此操作时,导入失败。

我的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.trial</groupId>
    <artifactId>books</artifactId>
    <version>1.0-SNAPSHOT</version>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>1.0.0</version>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>read-project-properties</goal>
                        </goals>
                        <configuration>
                            <files>
                            <file>${basedir}/versions.properties</file>
                            </files>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <!-- SPRING -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        ...
    </dependencies>
</project>

虽然pom.xml上没有显示错误,但导入开始失败(在pom.xml上设置的属性时工作正常):

import org.springframework.beans.factory.annotation.Autowired;

抛出:

  

错误:(6,52)java:package   org.springframework.beans.factory.annotation不存在

versions.properties看起来像:

springframework.version = 5.0.1.RELEASE

发生了什么事?我做错了什么?

非常感谢

1 个答案:

答案 0 :(得分:0)

你知道你可以使用这样的东西:

public function get_team()
{
    $this->load->library('Datatables');
    $this->datatables->select('*')
                ->unset_column('id')
                ->from('oric_team');
   echo $this->datatables->generate('json', '');

}

将版本外部化为属性文件没有任何优势。