成功编译后带有maven的未生成目录

时间:2019-01-07 21:36:20

标签: maven maven-plugin

我想在目标路径中创建一个文件夹。之后,我将在其中生成代码。我研究了很多。我需要使用Build Helper插件,但是当我使用它时,插件什么也不做。我共享我的Maven版本和pom.xml文件

Apache Maven 3.5.2
Maven home: /usr/share/maven
Java version: 1.8.0_191, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-43-generic", arch: "amd64", family: "unix"

我的pom.xml是

<modelVersion>4.0.0</modelVersion>

    <groupId>com.company.test</groupId>
    <artifactId>mavenTest</artifactId>
    <version>1.0-SNAPSHOT</version>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.10</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <directory>${project.build.outputDirectory}/test1</directory>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

编译结果为SUCCESS,但未生成test1文件。

mvn compile
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building mavenTest 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- build-helper-maven-plugin:1.10:add-source (add-source) @ mavenTest ---
[INFO] Source directory: /home/oocalan/workspace/mavenTest/target/classes/test1 added.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mavenTest ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ mavenTest ---
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.194 s
[INFO] Finished at: 2019-01-07T23:54:25+03:00
[INFO] Final Memory: 11M/109M
[INFO] ------------------------------------------------------------------------

但是什么也没产生。看。您能解释一下原因吗?

ll target/classes/
    total 12
    drwxrwxr-x 2 user user 4096 Oca  7 23:43 ./
    drwxrwxr-x 4 user user 4096 Oca  7 23:43 ../
    -rw-rw-r-- 1 user user  541 Oca  7 23:43 SampleCode.class

感谢您的帮助!

0 个答案:

没有答案