English 中文(简体)
Maven Property Plugin - don t work in Legacy
原标题:Maven Properties Plugin - doesn t work in inheritance

I have this directory structure

root
 |- pom.xml
 |- submodule1
      |- pom.xml
      |- project.properties
      |- subsubmodules
           |-pom.xml

分层1 遗产和子子遗产继承分层1

Subsubmodules has dependencies that uses properties from submodule1 s project.properties to have define its version. ie in Subsubmodules

<dependency>
 <groupId>some.org</groupId>
<artifactId>someartifact</artifactId>
<version>${themodules.version}</version>
</dependency>

项目。 二级医院

themodules.version = 1.0

因此,我把财产归根于om。

<project>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>properties-maven-plugin</artifactId>
        <version>1.0-alpha-2</version>
        <executions>
          <execution>
            <phase>initialize</phase>
            <goals>
              <goal>read-project-properties</goal>
            </goals>
            <configuration>
              <files>
              <!-- *edited from earlier post <file>etc/config/dev.properties</file>-->
<file>${basedir}/project.properties</file>
              </files>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

然后,我安装了根基层的马夫。 Maven说,它可以在附属企业中解决1美元。

我还在分层层占用了碎块,而且仍然能够解决。

Help pls

问题回答

Had a similar problem with code another developer checked in. They had the properties-maven-plugin under the root pom.xml.

I moved it out to each subproject that consumed the properties, and made it path relative. Since the main pom is in ${project.basedir}, the subproject will be in ../${project.basedir}.

That is, I added the plugin to the plugins element in those poms, and set the file element to ${project.basedir}/../default-pom.properties.

我这样做了。

Nothing to do with inheritance here, you just need add location of your project.properties to properties-maven-plugin s configuration in your root pom.xml:

<configuration>
  <files>
    <file>etc/config/dev.properties</file>
    <file>${project.basedir}/submodule1/project.properties</file>
  </files>
</configuration>

然后在根基层安装冲积层。





相关问题
Maven plugin for gathering source code statistics [closed]

Our project is based on J2EE and we would like to know if there is a open source maven-plugin which either integrates with cloc (Refer How can I measure source code statistics?) or other tools?

Transitive dependencies in maven plugins

Are dependencies in Maven plugins supposed to resolve their transitive dependencies or do they have to be manually added to the plugin dependencies?

Signing Applet with Maven jar plug-in and Bouncy Castle

I have a problem with a signed Java applet - specifically, why it is not signed using my certificate. I m using Maven in Eclipse. The applet (a) allows the user to choose a local file or directory, (...

Change output directory for apt-maven-plugin

I am using apt-maven-plugin to process some Beehive Netui annotations before building a war. The output of the apt processing is a _pageflow directory which contains struts config files (xml text) ...

Compile scala classes with debug info through Maven

I have a scala project that I use Maven and the maven-scala-plugin to compile. I need to include debug information in the compiled classes and I was wondering is there a way to ask Maven or the scala ...

热门标签