Maven is not downloading jars

2019-09-05 13:43发布

问题:

I'm using Maven but so after declaring dependencies , i can't find the jars .

So I'm getting the "cannot be resolved to a type" error

What's the cause , can it be internet connection problem? Is there a maven command that downloads jars?

Any idea please

Here's the 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">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>squashtest-csp-tm</artifactId>
    <groupId>org.squashtest.tm</groupId>
    <version>1.2.0.RELEASE</version>
  </parent>
  <artifactId>org.squashtest.csp.tm.web</artifactId>
  <name>org.squashtest.csp.tm.web</name>
  <packaging>war</packaging>
  <properties>
    <bundle.name>${project.artifactId}</bundle.name>
    <bundle.symbolicName>${project.artifactId}</bundle.symbolicName>
    <bundle.namespace>org.squashtest.csp.tm.web</bundle.namespace>
    <bundle.contextPath>tm</bundle.contextPath>
    <jasperreports.build.outputDirectory>${project.build.directory}/jasperreports/compiled</jasperreports.build.outputDirectory>
    <jasperreports.messagesDirectory>${basedir}/src/main/jasperreports/messages</jasperreports.messagesDirectory>
  </properties>

  <dependencies>
        <!-- ====== SQUASHTEST ====== -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>springdm-bundle-dependencies</artifactId>
      <version>${project.version}</version>
      <type>pom</type>    
    </dependency>
    <dependency>
      <groupId>org.squashtest.tm</groupId>
      <artifactId>core.foundation</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.squashtest.tm</groupId>
      <artifactId>core.report.api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>org.squashtest.csp.tm.service</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.squashtest.tm</groupId>
      <artifactId>core.bugtracker.api</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>core.web</artifactId>
      <version>${project.version}</version>
      <classifier>classes</classifier>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>spock-test-dependencies</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>org.squashtest.csp.tools.unittest</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

        <!-- ====== /SQUASHTEST ====== -->

        <!-- ====== JEE API ====== -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>com.springsource.javax.servlet</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.el</groupId>
      <artifactId>com.springsource.javax.el</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>com.springsource.javax.servlet.jsp</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>com.springsource.javax.servlet.jsp.jstl</artifactId>
    </dependency>
        <!-- ====== /JEE API ====== -->

        <!-- ====== JSE DI API ====== -->
    <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>com.springsource.javax.inject</artifactId>
    </dependency>
        <!-- ====== /JSE DI API ====== -->

        <!-- ====== LOGGING ====== -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>com.springsource.slf4j.api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>com.springsource.slf4j.log4j</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>com.springsource.slf4j.org.apache.commons.logging</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.log4j</groupId>
      <artifactId>com.springsource.org.apache.log4j</artifactId>
    </dependency>
        <!-- ====== /LOGGING ====== -->

        <!-- ====== SPRING DI ====== -->
        <!-- Required by Spring MVC -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>org.springframework.context.support</artifactId>
    </dependency>
        <!-- ====== /SPRING DI ====== -->

        <!-- ====== SPRING DM WEB CONTEXT ====== -->
    <dependency>
      <groupId>org.springframework.osgi</groupId>
      <artifactId>spring-osgi-web</artifactId>
      <scope>runtime</scope>
    </dependency>
        <!-- ====== /SPRING DM WEB CONTEXT ====== -->

        <!-- ====== XML PARSER ====== -->
        <!-- Required by jstl impl -->
    <dependency>
      <groupId>org.apache.xmlcommons</groupId>
      <artifactId>com.springsource.org.apache.xmlcommons</artifactId>
      <version>1.3.4</version>
      <scope>runtime</scope>
    </dependency>
        <!-- ====== /XML PARSER ====== -->

        <!-- ====== SPRING MVC ====== -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>org.springframework.web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>org.springframework.web.servlet</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>org.springframework.beans</artifactId>
      <version>${spring.version}</version>
    </dependency>
        <!-- ====== /SPRING MVC ====== -->

        <!-- ====== URL REWRITING ====== -->
    <dependency>
      <groupId>org.tuckey</groupId>
      <artifactId>com.springsource.org.tuckey.web.filters.urlrewrite</artifactId>
    </dependency>
        <!-- ====== /URL REWRITING ====== -->

        <!-- ====== VALIDATION ====== -->
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>com.springsource.javax.validation</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>com.springsource.org.hibernate.validator</artifactId>
    </dependency>
        <!-- ====== /VALIDATION ====== -->

        <!-- ===== ASPECTJ ===== -->
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>com.springsource.org.aspectj.runtime</artifactId>
      <version>${aspectj.version}</version>
    </dependency>
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>com.springsource.org.aspectj.weaver</artifactId>
      <version>${aspectj.version}</version>
    </dependency>
        <!-- ===== / ASPECTJ ===== -->

        <!-- ===== JACKSON ===== -->
    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>com.springsource.org.codehaus.jackson.mapper</artifactId>

    </dependency>
    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>com.springsource.org.codehaus.jackson</artifactId>

    </dependency>
    <dependency>
      <groupId>org.joda</groupId>
      <artifactId>com.springsource.org.joda.time</artifactId>

    </dependency>
        <!-- ===== / JACKSON ===== -->

        <!-- ====== FILE UPLOAD ====== -->
    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
        <!-- ====== /FILE UPLOAD ====== -->

        <!-- ====== JASPER REPORTS ====== -->
        <!-- 
            We need this to compile the reports. Our OSGi wrapped artifact wont 
            work and plugin dependency wont be the one picked
        -->
    <dependency>
      <groupId>net.sf.jasperreports</groupId>
      <artifactId>jasperreports</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>

        <!-- We need this at runtime (OSGi bundle) -->
    <dependency>
      <groupId>net.sf.jasperreports</groupId>
      <artifactId>org.squashtest.net.sf.jasperreports</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.apache.commons</groupId>
          <artifactId>com.springsource.org.apache.commons.logging</artifactId>
        </exclusion>
      </exclusions>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.beanshell</groupId>
      <artifactId>com.springsource.bsh</artifactId>
      <version>2.0.0.b4</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.xerces</groupId>
      <artifactId>com.springsource.org.apache.xerces</artifactId>
      <version>2.9.1</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.xml</groupId>
      <artifactId>com.springsource.org.apache.xml.resolver</artifactId>
      <version>1.2.0</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>net.htmlparser.jericho</groupId>
      <artifactId>org.squashtest.net.htmlparser.jericho</artifactId>
      <version>3.1</version>
    </dependency>
        <!-- ====== /JASPER REPORTS ====== -->

  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>

    <testResources>
      <testResource>
        <directory>${project.basedir}/src/test/resources</directory>
        <filtering>false</filtering>
      </testResource>
    </testResources>


    <testSourceDirectory>src/test/groovy</testSourceDirectory>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>

            <!-- ====== SPOCK TESTS ====== -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>



            <!-- ====== /SPOCK TESTS ====== -->

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
                    <!-- manifestLocation>META-INF</manifestLocation -->
          <instructions>
            <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
            <Bundle-Version>${project.version}</Bundle-Version>
            <Export-Package>
              !${bundle.namespace}.internal.*,
              ${bundle.namespace}.*;version="${project.version}"
            </Export-Package>
            <Private-Package>${bundle.namespace}.internal.*</Private-Package>
            <Include-Resource>
              src/main/webapp,
              src/main/resources
            </Include-Resource>
            <Bundle-ClassPath>.,WEB-INF/classes,WEB-INF/reports</Bundle-ClassPath>
            <Fragment-Host>org.squashtest.tm.core.web</Fragment-Host>
                        <!-- Runtime classes defined in config files such as web.xml and spring 
                            should be manually imported below -->
            <Import-Package>
                            <!-- some dependency needs the commons.lang version 2.5.0, however 
                                it is already used and exported as 2.4 in other bundles -->
              org.squashtest.csp.core.web.utils;
              version="${project.version}",
              *
            </Import-Package>
          </instructions>
          <supportedProjectTypes>
            <supportedProjectType>jar</supportedProjectType>
            <supportedProjectType>bundle</supportedProjectType>
            <supportedProjectType>war</supportedProjectType>
          </supportedProjectTypes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jasperreports-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>compile-reports</goal>
            </goals>
            <configuration>
              <outputDirectory>${jasperreports.build.outputDirectory}</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <failOnMissingWebXml>false</failOnMissingWebXml>
          <webResources>
            <resource>
              <directory>${jasperreports.build.outputDirectory}</directory>
              <targetPath>WEB-INF/reports</targetPath>
            </resource>
            <resource>
              <directory>${jasperreports.messagesDirectory}</directory>
              <targetPath>WEB-INF/reports/messages</targetPath>
            </resource>
            <resource>
              <directory>${project.build.outputDirectory}/META-INF</directory>
              <targetPath>META-INF</targetPath>
            </resource>
          </webResources>
          <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF
                </manifestFile>
          </archive>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>
                                        jasperreports-maven-plugin
                                    </artifactId>
                                    <versionRange>
                                        [1.0-beta-2,)
                                    </versionRange>
                                    <goals>
                                        <goal>compile-reports</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.apache.felix</groupId>
                                    <artifactId>
                                        maven-bundle-plugin
                                    </artifactId>
                                    <versionRange>
                                        [2.3.7,)
                                    </versionRange>
                                    <goals>
                                        <goal>manifest</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>eclipse</id>
      <activation>
        <file>
          <exists>${basedir}\.project</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-reports-to-web-inf</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>

                <configuration>
                  <outputDirectory>${basedir}/WEB-INF/reports</outputDirectory>
                  <resources>
                    <resource>
                      <directory>${jasperreports.build.outputDirectory}</directory>
                    </resource>
                  </resources>
                </configuration>
              </execution>

              <execution>
                <id>copy-reports-messages-to-web-inf</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>

                <configuration>
                  <outputDirectory>${basedir}/WEB-INF/reports/messages</outputDirectory>
                  <resources>
                    <resource>
                      <directory>${jasperreports.messagesDirectory}</directory>
                    </resource>
                  </resources>
                </configuration>
              </execution>

            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>

The error is :

 [INFO] BUILD FAILURE
 [INFO]------------------------------------------------------------------------
 [INFO] Total time: 4.812s [INFO] Finished at: Fri Jul 13 16:49:06 GMT+01:00 2012
 [INFO] Final Memory: 12M/34M
 [INFO] ------------------------------------------------------------------------
 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project org.squashtest.csp.tm.web: Compilation failure
 [ERROR] Found 12 errors and 0 warnings.