search

Home  >  Q&A  >  body text

java - Maven项目打包安装报错?

公司的项目,都是配置好的,我用的IDE是MyEclipse 10.5,配置的是Maven 3.3.9,以前单独打包安装模块没问题,现在一install就报错:

[WARNING] 
[WARNING] Some problems were encountered while building the effective model for ...
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. @ ...:[unknown-version], ..., line 47, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ ...:[unknown-version], ..., line 37, 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] 

打开pom发现插件已经安装:

<build>
        <finalName>...</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <version>3.1</version>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <version>2.6</version>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

为什么?该怎么做?

大家讲道理大家讲道理2897 days ago438

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 09:51:16

    You must add a version outside, as follows:

    <build>
            <finalName>...</finalName>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <version>3.1</version>
                        <source>1.7</source>
                        <target>1.7</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.6</version>
                    <configuration>
                        <version>2.6</version>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
            </plugins>
        </build>

    Besides, this is just a warning, you can still play normally if you ignore it

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 09:51:16

    <build>
        <finalName>...</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    **<version>3.1</version>**
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    **<version>2.6</version>**
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

    version I wrote it in the wrong place. ^_^

    reply
    0
  • 黄舟

    黄舟2017-04-18 09:51:16

    Maven uses groupId + artifactId + version to specify a dependent environment.
    And you don’t have a version value now. Those in the configuration are just the parameters passed to this plug-in.

    reply
    0
  • Cancelreply