自定义jar包,将配置文件不打进jar包的结构设置

<build>
      <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-dependency-plugin</artifactId>
                                    <versionRange>[2.0,)</versionRange>
                                    <goals>
                                        <goal>copy-dependencies</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-jar-plugin</artifactId>
              <version>2.4</version>
              <executions>
                  <execution>
                      <phase>package</phase>
                      <goals>
                          <goal>jar</goal>
                      </goals>
                  </execution>
              </executions>
              <configuration>
                  <archive>
                      <manifest>
                          <addClasspath>true</addClasspath>
                          <classpathPrefix>lib/</classpathPrefix>
                          <mainClass>gftchina.sds.Main</mainClass>
                      </manifest>
                      <manifestEntries>
                          <Class-Path>.</Class-Path>
                      </manifestEntries>
                  </archive>
                  <excludes>
                      <exclude>logback.xml</exclude>
                      <exclude>config/**</exclude>
                      <exclude>data/**</exclude>
                  </excludes>
              </configuration>
          </plugin>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-resources-plugin</artifactId>
              <version>2.5</version>
              <executions>
                  <execution>
                      <id>copy-resources</id>
                      <phase>package</phase>
                      <goals>
                          <goal>copy-resources</goal>
                      </goals>
                      <configuration>
                          <encoding>UTF-8</encoding>
                          <outputDirectory>${project.build.directory}/dist</outputDirectory>
                          <resources>
                              <resource>
                                  <directory>src/main/resources/</directory>
                                  <includes>
                                      <include>logback.xml</include>
                                      <include>config/*</include>
                                      <include>data/*</include>
                                  </includes>
                                  <filtering>true</filtering>
                              </resource>
                          </resources>
                      </configuration>
                  </execution>                  
              </executions>
          </plugin>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-dependency-plugin</artifactId>
              <version>2.1</version>
              <executions>
                  <execution>
                      <id>copy-dependencies</id>
                      <phase>package</phase>
                      <goals>
                          <goal>copy-dependencies</goal>
                      </goals>
                  </execution>
              </executions>
              <configuration>
                  <outputDirectory>${project.build.directory}/dist/lib</outputDirectory>
                  <overWriteReleases>false</overWriteReleases>
                  <overWriteSnapshots>false</overWriteSnapshots>
                  <overWriteIfNewer>true</overWriteIfNewer>
                  <excludeArtifactIds>junit</excludeArtifactIds>
              </configuration>
          </plugin>
      </plugins>
  </build>
posted @ 2012-07-30 09:50  疯长的胡茬  阅读(1014)  评论(0编辑  收藏  举报