【问题标题】:How to track a jar with Maven?如何使用 Maven 跟踪 jar?
【发布时间】:2012-07-30 04:10:00
【问题描述】:

我在命令行中使用 maven 来构建我的应用程序,并且构建成功,但是在 eclipse 中我得到了错误:

The repository system is offline but the artifact org.codehaus.plexus:plexus-archiver:jar:1.2 is not available in the local repository.

虽然我做了更新项目配置和更新依赖项,但我想知道这个 jar 是由哪个插件或依赖项负责的?

以下是我正在使用的插件:

<plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>hibernate3-maven-plugin</artifactId>
                <version>2.2</version>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>hbm2ddl</goal> 
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <components>
                        <component>
                            <name>hbm2ddl</name>
                            <implementation>annotationconfiguration</implementation>
                        </component>
                        <component>
                            <name>hbmdoc</name>
                        </component>
                    </components>
                    <componentProperties>
                        <configurationfile>/target/classes/hibernate.cfg.xml</configurationfile>
                        <outputfilename>CreateTables.sql</outputfilename>
                        <namingstrategy>com.xeno.advertisingsuite.web</namingstrategy>
                        <drop>false</drop>
                        <create>true</create>
                        <export>false</export>
                        <format>true</format>
                    </componentProperties>
                </configuration>
            </plugin>


            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>

            <!-- run command: mvn tomcat7:run -->
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.0-beta-1</version>
                <configuration>
                    <path>/${project.build.finalName}</path>
                </configuration>
            </plugin>

            <!-- run command: mvn 7:run -->
            <plugin>
                <groupId>com.googlecode.t7mp</groupId>
                <artifactId>maven-t7-plugin</artifactId>
                <version>0.9.6</version>
                <configuration>
                    <tomcatHttpPort>8081</tomcatHttpPort>
                    <tomcatShutdownPort>8008</tomcatShutdownPort>
                    <tomcatVersion>7.0.22</tomcatVersion>
                </configuration>
            </plugin>

<plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>aspectj-maven-plugin</artifactId>
      <version>1.4</version>
      <configuration>
        <complianceLevel>1.6</complianceLevel>
        <encoding>UTF-8</encoding>
        <aspectLibraries>
          <aspectLibrary>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
          </aspectLibrary>
        </aspectLibraries>
        <Xlint>warning</Xlint> 
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>compile</goal>
            <goal>test-compile</goal> 
          </goals>
        </execution>
      </executions>
    </plugin>


     </plugins>

请告知如何解决这个问题,谢谢。

【问题讨论】:

    标签: maven dependencies dependency-management


    【解决方案1】:

    尝试通过mvn dependency:resolve-plugins 解决插件依赖关系 - 它将打印 maven 插件的依赖关系树输出。

    打开调试模式的选项也有很大帮助:mvn -X

    【讨论】:

    • 尝试在本地存储库 (~/.m2/repository) 的 *.pom 文件中搜索 plexus-archiver id
    • 在我的 .m2 中有这个 jar 的其他版本不是必需的,我想知道这个 jar 到底是什么插件要求的,所以我可以更改它。
    • 你可以使用精确的版本来 grep 使用: grep -r --include="*.pom" "plexus-archiver\s1.2"
    • 还有mvn -u 选项和删除最后更新的标记(*.lastUpdated 文件)有助于更新依赖关系
    猜你喜欢
    • 1970-01-01
    • 2023-03-30
    • 2019-02-17
    • 1970-01-01
    • 2011-05-08
    • 2015-04-09
    • 2021-12-24
    • 2015-08-06
    • 2011-05-09
    相关资源
    最近更新 更多