Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven:Pofile:依赖项重复_Maven_Maven Profiles - Fatal编程技术网

Maven:Pofile:依赖项重复

Maven:Pofile:依赖项重复,maven,maven-profiles,Maven,Maven Profiles,我正在尝试我的手第一次与maven配置文件。 在我们的项目中,我们有几个依赖项(人们会期望:))。 现在我们要创建一个概要文件,对于它,所有依赖项都将“范围”设置为“提供” 所以有两个配置文件,一个是 提供了且没有范围 我的问题是,在创建具有多个概要文件的pom.xml时,会重复很多行。基本上,除了提供的之外,两个概要文件在dependencies部分中具有相同的行集 我正在设法缩短这个文件。我正在寻找实现这一目标的方法。我没有找到一个好的解决办法。所以在这里发布一个问题。希望有人遇到了这一点,

我正在尝试我的手第一次与maven配置文件。 在我们的项目中,我们有几个依赖项(人们会期望:))。 现在我们要创建一个概要文件,对于它,所有依赖项都将“范围”设置为“提供”

所以有两个配置文件,一个是
提供了
且没有范围

我的问题是,在创建具有多个概要文件的pom.xml时,会重复很多行。基本上,除了提供的
之外,两个概要文件在dependencies部分中具有相同的行集

我正在设法缩短这个文件。我正在寻找实现这一目标的方法。我没有找到一个好的解决办法。所以在这里发布一个问题。希望有人遇到了这一点,可以帮助我在这里

这就是我的pom.xml现在的样子: 有没有办法缩短生产线?删除pom.xml中的所有重复?谢谢

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>steel-thread</artifactId>
        <groupId>com.securityx</groupId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>feature-service</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <properties>
        <junit.version>4.11</junit.version>
        <joda.time.version>2.3</joda.time.version>
        <joda.convert.version>1.6</joda.convert.version>
        <log4j.version>1.2.16</log4j.version>
        <guava.version>16.0.1</guava.version>
        <hbase.version>0.98.6-cdh5.2.1</hbase.version>
        <solr.version>4.4.0-cdh5.2.1</solr.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <profiles>
        <profile>
            <id>dev</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.apache.hbase</groupId>
                    <artifactId>hbase-client</artifactId>
                    <version>${hbase.version}</version>
                </dependency>
                <dependency>
                    <groupId>joda-time</groupId>
                    <artifactId>joda-time</artifactId>
                    <version>${joda.time.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.joda</groupId>
                    <artifactId>joda-convert</artifactId>
                    <version>${joda.convert.version}</version>
                </dependency>
            </dependencies>    
        </profile>
        <profile>
            <id>prod</id>
            <dependencies>
                <dependency>
                    <groupId>org.apache.hbase</groupId>
                    <artifactId>hbase-client</artifactId>
                    <version>${hbase.version}</version>
                    <exclusions>
                        <exclusion>
                            <groupId>org.slf4j</groupId>
                            <artifactId>slf4j-log4j12</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>log4j</groupId>
                            <artifactId>log4j</artifactId>
                        </exclusion>
                    </exclusions>
                    <scope>provided</scope>
                </dependency>

                <dependency>
                    <groupId>joda-time</groupId>
                    <artifactId>joda-time</artifactId>
                    <version>${joda.time.version}</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.joda</groupId>
                    <artifactId>joda-convert</artifactId>
                    <version>${joda.convert.version}</version>
                    <scope>provided</scope>
                </dependency>

            </dependencies>

        </profile>
    </profiles>

    <build>
        <!--<sourceDirectory>src/main/scala</sourceDirectory>-->
        <!--<testSourceDirectory>src/test/scala</testSourceDirectory>-->
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.scala-tools</groupId>
                    <artifactId>maven-scala-plugin</artifactId>
                    <version>2.15.2</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <!-- To use the plugin goals in your POM or parent POM -->
        <plugins>
            <plugin>
                <groupId>org.scala-tools</groupId>
                <artifactId>maven-scala-plugin</artifactId>

                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>add-source</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <!--<configuration>-->
                <!--<args>-->
                <!--&lt;!&ndash;                        <arg>-make:transitive</arg>&ndash;&gt;-->
                <!--<arg>-g:notailcalls</arg>-->
                <!--&lt;!&ndash; <arg>-feature</arg>    &ndash;&gt;-->
                <!--</args>-->
                <!--</configuration>-->
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

            <!-- Create a fat jar -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.6</version>
                <configuration>
                    <createDependencyReducedPom>true</createDependencyReducedPom>
                    <!-- Exclude all duplicates -->
                    <filters>
                        <filter>
                            <artifact>org.apache.avro:avro-tools</artifact>
                            <excludes>
                                <exclude>org/slf4j/**</exclude>
                                <exclude>org/apache/avro/**</exclude>
                                <exclude>org/codehaus/jackson/**</exclude>
                                <exclude>com/thoughtworks/**</exclude>
                                <exclude>org/apache/commons/**</exclude>
                                <exclude>org/tukaani/xz/**</exclude>
                                <exclude>org/xerial/snappy/**</exclude>
                                <exclude>javax/servlet/**</exclude>
                                <exclude>org/apache/hadoop/**</exclude>
                            </excludes>
                        </filter>
                        <filter>
                            <artifact>org.apache.phoenix:phoenix-client-minimal</artifact>
                            <excludes>
                                <exclude>org/slf4j/**</exclude>
                                <exclude>org/apache/log4j/**</exclude>
                                <exclude>com/google/common/**</exclude>
                                <exclude>org/codehaus/jackson/**</exclude>
                                <exclude>org/apache/avro/**</exclude>
                            </excludes>
                        </filter>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
                    </filters>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <!--  The service main class -->
                                    <mainClass>com.securityx.modelfeature.FeatureService</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Embed the project version in the JAR’s manifest as the Implementation-Version -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.1.6</version>
            </plugin>

        </plugins>
    </build>

</project>

钢螺纹
com.securityx
1.0.0-SNAPSHOT
4.0.0
特色服务
1.0.0-SNAPSHOT
4.11
2.3
1.6
1.2.16
16.0.1
0.98.6-cdh5.2.1
4.4.0-cdh5.2.1
UTF-8
发展
真的
org.apache.hbase
hbase客户端
${hbase.version}
乔达时间
乔达时间
${joda.time.version}
org.joda
乔达转换
${joda.convert.version}
戳
org.apache.hbase
hbase客户端
${hbase.version}
org.slf4j
slf4j-log4j12
log4j
log4j
假如
乔达时间
乔达时间
${joda.time.version}
假如
org.joda
乔达转换
${joda.convert.version}
假如
org.scala-tools
maven scala插件
2.15.2
org.scala-tools
maven scala插件
编译
编译
编译
过程资源
添加源
编译
org.apache.maven.plugins
maven编译器插件
2.3.2
1.6
1.6
org.apache.maven.plugins
maven阴影插件
1.6
真的
avro:avro工具
org/slf4j/**
org/apache/avro/**
org/codehaus/jackson/**
com/thoughtworks/**
org/apache/commons/**
org/tukaani/xz/**
org/xerial/snappy/**
javax/servlet/**
org/apache/hadoop/**
凤凰城:凤凰城客户端
org/slf4j/**
org/apache/log4j/**
com/google/common/**
org/codehaus/jackson/**
org/apache/avro/**
*:*
META-INF/*.SF
META-INF/*.DSA
META-INF/*.RSA
包裹
阴凉处
com.securityx.modelfeature.FeatureService
org.apache.maven.plugins
maven jar插件
2.3.2
特鲁