我使用複製依賴關係目標來複制當前工件的依賴關係。 但它不會複製範圍'provided'的依賴關係。 如何解決它?強制Maven 3複製「提供」依賴關係
XML配置爲標準配置:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>lib</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeArtifactIds>project-services</excludeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<finalName>project-web</finalName>
</build>
我爲什麼要這麼做? 因爲我必須同時支持ant和maven構建工作。 因此,我想通過運行mvn install -o將所有依賴項複製到單獨的目錄中。在Ant build.xml中,我將路徑作爲類路徑包含到該目錄中。在那之後,Ant會建立ear文件幷包含整個lib目錄,包括音頻系統tools.jar和其他「提供」的jar文件。 的Apache Maven的版本是3.0.3
Maven的命令是否運行? – orique
你爲什麼想這樣做?使用範圍=提供的依賴關係是這樣標記的,因爲它們已經存在於目標環境中。你爲什麼要複製它們? – OldCurmudgeon
爲什麼要標記他們提供,如果你需要複製它們? –