Maven和Eclipse - 不要下载依赖项

时间:2012-03-23 14:13:39

标签: eclipse maven

我有关于maven和eclipse的问题。 语境: 我有两个项目,都是.jar和版本SNAPSHOT。 本地存储库中安装了两个工件。

然后问题是我尝试将第一个项目作为依赖项。

例如

mvn clean install

在我的工作区之后,进入类路径似乎不是

 <?xml version="1.0" encoding="UTF-8"?> 
 <classpath>    
   <classpathentry kind="src" path="src"/>  
   <classpathentry excluding="**/*.java" including="**/*.*" kind="src" path="fwk-conf"/>    
   <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>

我不知道,这种依赖不会下载。

非常感谢。

main pom.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <!-- Tous les composants de l'application "herite" du projet ROOT -->
    <parent>
        <groupId>com.company.eur00</groupId>
        <artifactId>root</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>
    <artifactId>eur00Java</artifactId>

    <packaging>jar</packaging>

    <name>Projet JAVA eur</name>
    <description>
        Couche contenant le code metier de l'application
    </description>
    <build>
        <sourceDirectory>src</sourceDirectory>

        <resources>
            <resource>
                <directory>fwk-conf</directory>
                <includes>
                    <include>**/*.*</include>
                </includes>
            </resource>
            <resource>
                <directory>src</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>

    </build>
    <properties>
        <svnModuleName>eur00Java</svnModuleName>
        <versionToolBoxxml>3.2.1</versionToolBoxxml>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.company.fwk</groupId>
            <artifactId>fwk-core</artifactId>
            <version>${versionLego}</version>
        </dependency>
        <dependency>
            <groupId>com.company.fwk</groupId>
            <artifactId>fwk-ldapSecurity</artifactId>
            <version>${versionLego}</version>
        </dependency>
        <!-- Hibernate -->
        <dependency>
            <groupId>com.company.fwk</groupId>
            <artifactId>fwk-i18n-hibernate</artifactId>
            <version>${versionLego}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.3.2.GA</version>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
          <groupId>oracle.jdbc-driver</groupId>
          <artifactId>ojdbc5</artifactId>
          <version>11.2.0.1.0</version>
        </dependency>
        <dependency>
          <groupId>jboss</groupId>
          <artifactId>javassist</artifactId>
          <version>3.7.ga</version>
        </dependency>
        <dependency>
            <groupId>com.company.fwk</groupId>
            <artifactId>fwk-common-security</artifactId>
            <version>3.8.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.5.11</version>
        </dependency>

         <dependency>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
                <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>com.company.cxl</groupId>
            <artifactId>toolboxxml</artifactId>
            <version>${versionToolBoxxml}</version>
        </dependency>
        <dependency>
            <groupId>com.company.cxl</groupId>
            <artifactId>toolboxxml-jaxb</artifactId>
            <version>${versionToolBoxxml}</version>
        </dependency>
        <dependency>
            <groupId>stax</groupId>
            <artifactId>stax-api</artifactId>
            <version>1.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.company.eur00</groupId>
            <artifactId>ps-eur-payment-objects</artifactId>
            <version>1.0.0-SNAPSHOT</version>

        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>updateEclipse</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-eclipse-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>clean</phase>
                                <id>classpath</id>
                                <goals>
                                    <goal>eclipse</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>coverageClassFilter</id>
            <reporting>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>cobertura-maven-plugin</artifactId>
                        <configuration>
                            <instrumentation>
                                <excludes>
                                    <exclude>
                                        com/company/eur00/db/**/*.class
                                    </exclude>
                                    <exclude>
                                        com/company/eur00/**/*Exception*.class
                                    </exclude>
                                </excludes>
                            </instrumentation>
                        </configuration>
                    </plugin>
                </plugins>
            </reporting>
        </profile>      
    </profiles>
</project>

Seconday pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
    <build>
        <sourceDirectory>${basedir}/src/main/java/</sourceDirectory>
        <resources>
            <resource>
                <directory>${basedir}/src/main/resources/</directory>
            </resource>
            <resource>
                <includes>
                    <include>**/*.xml</include>
                </includes>
                <directory>${basedir}/src/main/java/</directory>
            </resource>
        </resources>
        <testSourceDirectory>${basedir}/src/test/java/</testSourceDirectory>
        <testResources>
            <testResource>
                <directory>${basedir}/src/test/resources/</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>com.company.cxl.plugins</groupId>
                <artifactId>maven-toolboxxml-plugin</artifactId>
                <version>${toolboxxml.version}</version>
                <configuration>
                    <pdsFiles>
                        <param>src/main/resources/pds/EurService.pds</param>
                    </pdsFiles>
                    <sourceGenerationDirectory>src/main/java/</sourceGenerationDirectory>
                    <resourcesGenerationDirectory>src/main/resources/</resourcesGenerationDirectory>
                    <webappGenerationDirectory>src/main/webapp/</webappGenerationDirectory>
                    <packagesBO>
                        <param>com.company.xml</param>
                    </packagesBO>
                    <resourcesBO>
                        <param>schemas</param>
                    </resourcesBO>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1-beta-1</version>
                <configuration>
                    <webappDirectory>${basedir}/target/src/main/webapp/</webappDirectory>
                    <warSourceDirectory>${basedir}/src/main/webapp/</warSourceDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <wtpversion>1.5</wtpversion>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>assembly</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <descriptors>
                        <descriptor>assembly-wsdl.xml</descriptor>
                        <descriptor>assembly-lego.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <parent>
        <groupId>com.company.jip</groupId>
        <artifactId>psa-root</artifactId>
        <version>2.3.5</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.company.eur00</groupId>
    <artifactId>ps-eur-payment-objects</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>Objects Ps payment</name>
    <description>Objects Ps payment</description>
    <inceptionYear>2012</inceptionYear>
    <properties>
        <prdJip>eur00</prdJip>
        <svnUser>maven</svnUser>
        <svnRoot>/svn2.informatique.company.com/svn/eur00/Etudes/trunk</svnRoot>        
        <svnModuleName>PsEurPaymentObjects</svnModuleName>
        <sourceEncoding>UTF-8</sourceEncoding>
        <javaSourceCompatibility>1.5</javaSourceCompatibility>
        <javaTargetCompatibility>1.5</javaTargetCompatibility>
        <toolboxxml.version>3.2.1</toolboxxml.version>
    </properties>
    <developers>
        <developer>
            <name>user name</name>
            <id>userId</id>
            <email>user@mpsa.com</email>
            <organization>PSA</organization>
            <roles>
                <role>Developpeur Java</role>
            </roles>
        </developer>
    </developers>
    <dependencies>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>bouncycastle</groupId>
            <artifactId>bcprov-jdk15</artifactId>
            <version>133</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-codec</groupId>
                    <artifactId>commons-codec</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.5.11</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.5.11</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.5.11</version>
        </dependency>
        <dependency>
            <groupId>com.company.cxl</groupId>
            <artifactId>toolboxxml</artifactId>
            <version>${toolboxxml.version}</version>
        </dependency>
        <dependency>
            <groupId>jaxen</groupId>
            <artifactId>jaxen</artifactId>
            <version>1.1.1</version>
            <exclusions>
                <exclusion>
                    <groupId>dom4j</groupId>
                    <artifactId>dom4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xom</groupId>
                    <artifactId>xom</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>
        <dependency>
            <groupId>quartz</groupId>
            <artifactId>quartz</artifactId>
            <version>1.6.6</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>2.5.6</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>2.5.6</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context-support</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-web</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-beans</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <artifactId>stax-api</artifactId>
            <groupId>javax.xml.stream</groupId>
            <version>1.0-2</version>
        </dependency>
        <dependency>
            <groupId>wsdl4j</groupId>
            <artifactId>wsdl4j</artifactId>
            <version>1.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.security</groupId>
            <artifactId>wss4j</artifactId>
            <version>1.5.4</version>
            <exclusions>
                <exclusion>
                    <groupId>bouncycastle</groupId>
                    <artifactId>bcprov-jdk15</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.santuario</groupId>
                    <artifactId>xmlsec</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>axis</groupId>
                    <artifactId>axis</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>axis</groupId>
                    <artifactId>axis-ant</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>opensaml</groupId>
                    <artifactId>opensaml</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>bouncycastle</groupId>
                    <artifactId>bcprov-jdk16</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.codehaus.woodstox</groupId>
            <artifactId>wstx-asl</artifactId>
            <version>3.2.0</version>
            <exclusions>
                <exclusion>
                    <groupId>stax</groupId>
                    <artifactId>stax-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.6.2</version>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xmlParserAPIs</artifactId>
            <version>2.6.2</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.xfire</groupId>
            <artifactId>xfire-all</artifactId>
            <version>1.2.6-psa-3</version>
            <exclusions>
                <exclusion>
                    <groupId>org.codehaus.xfire</groupId>
                    <artifactId>xfire-aegis</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.xfire</groupId>
                    <artifactId>xfire-ws-security</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.xfire</groupId>
                    <artifactId>xfire-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.xfire</groupId>
                    <artifactId>xfire-java5</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.xfire</groupId>
                    <artifactId>xfire-generator</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.xfire</groupId>
                    <artifactId>xfire-xmlbeans</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.xfire</groupId>
                    <artifactId>xfire-annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.xfire</groupId>
                    <artifactId>xfire-jaxws</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.xfire</groupId>
                    <artifactId>xfire-spring</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.commons</groupId>
            <artifactId>XmlSchema</artifactId>
            <version>1.1</version>
            <exclusions>
                <exclusion>
                    <groupId>stax</groupId>
                    <artifactId>stax-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>xml-security</groupId>
            <artifactId>xmlsec</artifactId>
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.1</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.xml</groupId>
                    <artifactId>jsr173</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.xml.stream</groupId>
                    <artifactId>stax-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.1.9</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-xjc</artifactId>
            <version>2.1.9</version>
        </dependency>
        <dependency>
            <groupId>xfire</groupId>
            <artifactId>xfire-jsr181-api</artifactId>
            <version>1.0-M1</version>
        </dependency>
        <dependency>
            <groupId>com.company.cxl</groupId>
            <artifactId>toolboxxml-jaxb</artifactId>
            <version>${toolboxxml.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>bouncycastle</groupId>
            <artifactId>bcprov-jdk15</artifactId>
            <version>133</version>
        </dependency>
        <dependency>
            <artifactId>stax-api</artifactId>
            <groupId>javax.xml.stream</groupId>
            <version>1.0-2</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.xfire</groupId>
            <artifactId>bcprov-jdk14</artifactId>
            <version>133</version>
        </dependency>
        <dependency>
            <artifactId>stax-api</artifactId>
            <groupId>javax.xml.stream</groupId>
            <version>1.0-2</version>
        </dependency>
        <dependency>
            <groupId>castor</groupId>
            <artifactId>castor</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>stax-utils</groupId>
            <artifactId>stax-utils</artifactId>
            <version>snapshot-20040917</version>
        </dependency>
        <dependency>
            <groupId>oro</groupId>
            <artifactId>oro</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <artifactId>stax-api</artifactId>
            <groupId>javax.xml.stream</groupId>
            <version>1.0-2</version>
        </dependency>
        <dependency>
            <artifactId>stax-api</artifactId>
            <groupId>javax.xml.stream</groupId>
            <version>1.0-2</version>
        </dependency>
        <dependency>
            <artifactId>stax-api</artifactId>
            <groupId>javax.xml.stream</groupId>
            <version>1.0-2</version>
        </dependency>
        <dependency>
            <artifactId>stax-api</artifactId>
            <groupId>javax.xml.stream</groupId>
            <version>1.0-2</version>
        </dependency>
        <dependency>
            <artifactId>stax-api</artifactId>
            <groupId>javax.xml.stream</groupId>
            <version>1.0-2</version>
        </dependency>
    </dependencies>
</project>

1 个答案:

答案 0 :(得分:0)

使用Maven + Eclipse时,我建议:

  • 使用Maven 3
  • 使用最新的m2e Eclipse插件(以前的m2eclipse)
  • 确保您在eclipse内部和外部使用相同的Maven安装(您可以配置Eclipse)
  • 将项目导入为Maven项目

然后你应该能够在Eclipse内外构建项目。