相关疑难解决方法(0)

禁用父POM中定义的Maven插件

我正在使用父POM来定义一个我不想在子POM中运行的插件.如何完全禁用子pom中的插件?

约束:我无法更改父POM本身.

maven-2

144
推荐指数
3
解决办法
8万
查看次数

苦苦挣扎于Maven父/子插件配置继承

我正在尝试编写父pom,并且我定义了一个插件,但我需要更改所有继承实例的配置.所以,我可以在<pluginManagement>定义中加入一些配置,我可以在其中覆盖它<plugin>,但是如何让孩子们默认回到<pluginManagement>版本?

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.9.1</version>
                <executions...>
                <configuration>
                    <configLocation>
                        (used by all children)
                    </configLocation>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <configuration>
                <configLocation>
                    (unique to the parent)
                </configLocation>
            </configuration>
        </plugin>
    </plugins>
<build>
Run Code Online (Sandbox Code Playgroud)

那么,会发生什么是孩子继续显示父母的配置.

inheritance plugins maven

21
推荐指数
2
解决办法
1万
查看次数

使用带有Axis2 wsdl2code Maven插件的多个WSDL

我正在使用Maven2创建一个使用多个Web服务的客户端.我仅限于使用Axis2或支持Apache HttpClient作为HTTP管道的其他框架,因为这些服务需要与基于托管证书解决方案的集成集成HttpClient.

我熟悉CXF的代码生成Maven插件,允许在代码生成期间输入多个WSDL.但是,Axis2代码生成插件一次只能处理一个WSDL.

如何wsdl2code在代码生成阶段为每个WSDL 运行Maven ?我需要多个配置文件吗?

POM的构建部分如下所示:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
            <version>1.6.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>wsdl2code</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <unpackClasses>true</unpackClasses>
                <databindingName>adb</databindingName>
                <packageName>org.example.stackoverflow.axis2-maven</packageName>
                <!-- only one of these actually gets used by code generator -->
                <wsdlFile>src/main/resources/service1.wsdl</wsdlFile>
                <wsdlFile>src/main/resources/service2.wsdl</wsdlFile>
                <outputDirectory>target/generated-sources</outputDirectory>
                <syncMode>sync</syncMode>
            </configuration>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

参考

java axis2 code-generation wsdl2code maven

16
推荐指数
1
解决办法
1万
查看次数

在maven中配置不同文件类型的编码?

我使用maven-resource-plugin来过滤maven项目中的一些资源.在我的父项目中,我有:

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Run Code Online (Sandbox Code Playgroud)

在一个子项目中,我有一个test.properties文件,它是一个普通的java属性文件,默认编码= ISO-8859-1.该文件包含:

aboutText=Version ${project.version} © 2012 blabla
Run Code Online (Sandbox Code Playgroud)

为了确保正确过滤此文件,我将maven-resource-plugin拆分为单独的执行,每个执行都有其编码:

  <plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <configuration>
      <nonFilteredFileExtensions>
        <nonFilteredFileExtension>ico</nonFilteredFileExtension>
        <nonFilteredFileExtension>jar</nonFilteredFileExtension>
      </nonFilteredFileExtensions>
    </configuration>
    <executions>
      <execution>
        <id>filter-properties-files</id>
        <phase>generate-resources</phase>
        <goals>
          <goal>copy-resources</goal>
        </goals>
        <configuration>
          <!-- java properties files are encoded in ISO-8859-1 so when 
            filtering those files we stick with that encoding. -->
          <encoding>ISO-8859-1</encoding>
          <outputDirectory>${basedir}/after</outputDirectory>
          <resources>
            <resource>
              <filtering>true</filtering>
              <directory>${basedir}/before</directory>
              <includes>
                <include>**/*.properties</include>
              </includes>
            </resource>
          </resources>
        </configuration>
      </execution>
      <execution>
        <id>filter-non-properties-files</id>
        <phase>generate-resources</phase>
        <goals>
          <goal>copy-resources</goal>
        </goals>
        <configuration>
          <encoding>${project.build.sourceEncoding}</encoding>
          <outputDirectory>${basedir}/after</outputDirectory>
          <resources>
            <resource>
              <filtering>true</filtering>
              <directory>${basedir}/before</directory>
              <includes>
                <include>**/*.product</include>
                <include>**/*.inf</include> …
Run Code Online (Sandbox Code Playgroud)

encoding maven

16
推荐指数
2
解决办法
4391
查看次数

如何从子pom覆盖Maven 3.0父插件属性

我在parent.pom中有maven-war-plugin,因为我设置了manifestFile属性但是对于我的一个战争,我需要在META-INF下排除清单文件.

我在子pom中添加了我的war插件的属性</ manifestFile>配置,但它不起作用

java maven-plugin maven

5
推荐指数
1
解决办法
1万
查看次数