English 中文(简体)
如何制止 * E/CN.6/2009/1。
原标题:How to stop Apache maven <outputDirectory> to overwrite the folder

I have the following directory hierarchy:

generated 

   |    
   | -->java

Java名录有以下包装:com.model

在我汇编申请之前,我从某个地方复制/印制了java模型。

我使用《议定书》缓冲和我告诉大家,在新的一揽子计划下,同一名录上产生的文件:

Result : Protocol buffer generates the new package and deletes the old package.
I have no idea why does it do that although the package names are different?

这里,“我”的一部分用于从礼宾缓冲中产生ava:

        <plugin>
            <groupId>com.google.protobuf.tools</groupId>
            <artifactId>maven-protoc-plugin</artifactId>
            <configuration>
                <protocExecutable>C:protoc.exe</protocExecutable>
                <protoSourceRoot>./src/proto</protoSourceRoot>
                <outputDirectory>./src/generated/java</outputDirectory>

            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
最佳回答

如果你看一看 p子的代码,就会发现该代码被硬编码来清理该名录:

https://github.com/dtrott/maven-protoc-plugin/blob/master/src/main/java/com/google/protobuf/maven/AbstractProtocMojo.java#L154

// Quick fix to fix issues with two mvn installs in a row (ie no clean)
cleanDirectory(outputDirectory);

解决该问题有两种办法:要么将产出目录定在名录上,然后使用黑白本或黑白造面粉,将文档复制到你选择的目录中,要么修改黑白板,去除这一条线(或者更好,使之可以想象)。

Tommy

问题回答

我以以下方式解决了我的问题:

<plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <executions>
                  <execution>
                      <phase>generate-resources</phase>
                      <goals>
                          <goal>run</goal>
                      </goals>
                      <configuration>
                          <tasks>
                              <delete dir="./destination"/>
                              <copy todir="./destination">
                                    <fileset dir="./source"/>
                              </copy>
                              <delete dir="./source"/>
                          </tasks>
                      </configuration>
                  </execution>
              </executions>
        </plugin>

然而,我发现这一错误“安的建筑外观已经发生: 只能确定一个档案和遗嘱。”





相关问题
Derby gets stuck closing?

I ve got unit tests (in maven) that use derby. At the end of the test run, there is a very long pause, with these log messages before the pause. INFO: Closing Hibernate SessionFactory Nov 16, 2009 8:...

Execute goal on parent after children complete

I have a multi-module maven project (several levels of nesting). Normally, when I execute a maven build (like mvn install or whatever), maven will run all the goals for the parent project before ...

Including dependencies in a jar with Maven

Is there a way to force maven(2.0.9) to include all the dependencies in a single jar file? I have a project the builds into a single jar file. I want the classes from dependencies to be copied into ...

Java Equivalent of distcc

Distcc makes it easy to distribute a C or C++ compile job across a number of machines, and is a godsend for working with large, frequently-built codebases. An increasing number of our large projects ...

Maven Assembly Problem

I have a maven multiple-module project, which is giving me headaches in the assembly:assembly phase. I have a module which has an assembly defined in it which works fine when I invoke mvn assembly:...

热门标签