簡體   English   中英

使用maven-eclipse-plugin將文件夾中的偽裝jar文件指定到eclipse項目中,而不是M2_REPO變量

[英]using maven-eclipse-plugin for to specifiy depedency jar files from a folder into eclipse project, not M2_REPO variable

我希望and eclipse項目的JAR構建路徑(或build-path中的jar文件)指向本地目錄,該目錄指向名為“ lib”的eclipse項目,而不指向M2_REPO變量(我的maven本地存儲庫路徑)

在lib目錄中,有一些jar文件是通過覆蓋“ mave-dependency-plugin”中的“ copy-dependencies”目標復制的。我的意圖是eclipse項目是獨立的。

我嘗試了覆蓋目標configure-workspace和來自maven-eclipse-plugin的方法,但是它不起作用。

有沒有辦法做到這一點?

確保您可以覆蓋使用maven-eclipse-plugin生成的.classpath

  <plugin>
    <artifactId>maven-eclipse-plugin</artifactId>
    <version>2.8</version>
    <configuration>
      <wtpversion>1.5</wtpversion>
      <packaging>war</packaging>
      <wtpContextName>${project.artifactId}</wtpContextName>
      <buildOutputDirectory>WebContent/WEB-INF/classes</buildOutputDirectory>
      <additionalConfig>
        <file>
          <name>.classpath</name>
          <content><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
  <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/project-lib"/>
  <classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
</classpath>]]></content>
        </file>
      </additionalConfig>
      <buildcommands>
        <buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
        <buildcommand>org.eclipse.wst.common.project.facet.core.builder</buildcommand>
      </buildcommands>
    </configuration>
  </plugin>

我建議嘗試以下方法之一:

  • 使用Nexus之類的Maven資源庫管理器,並部署任何您不在可用資源庫中的jar。 然后使用“常規” Maven依賴項。
  • 使用系統Maven依賴項。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM