maven错误消息“缺少1个必需的工件”

时间:2013-07-01 06:55:18

标签: java maven pom.xml maven-assembly-plugin

现在,这是我的pom(.xml)配置:

<build>

    <resources>
        <resource>
            <directory>src/resources/development</directory>
            <filtering>true</filtering>
        </resource>
    </resources>

    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.9</version>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.8</version>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <inherited>true</inherited>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
                <execution>
                    <id>attach-sources</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <attach>true</attach>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.3.1</version>
            <configuration>
                <createChecksum>true</createChecksum>
            </configuration>
        </plugin>
        <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>mypackage.MyMainClass</mainClass>
      </manifest>
    </archive>
    <descriptorRefs>
      <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
  </configuration>
</plugin>
 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.8</version>
    <executions>
      <execution>
        <id>copy-dependencies</id>
        <phase>package</phase>
        <goals>
          <goal>copy-dependencies</goal>
        </goals>
        <configuration>
          <!-- configure the plugin here -->
        </configuration>
      </execution>
    </executions>
  </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
            <configuration></configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>

        <!--
        Plugin that can be configured to prevent deployment of artifact to the
        maven2 repository.
        -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.5</version>
        </plugin>

    </plugins>

</build>

<dependencies>
    <dependency>
        <groupId>com.vantage.iseek.content</groupId>
        <artifactId>iseek-content-publisher-ds</artifactId>
        <version>1.0.1-SNAPSHOT</version>
    </dependency>
    <dependency> 
        <groupId>com.vantage.iseek.content</groupId>
        <artifactId>iseek-content-api</artifactId>
        <version>1.0.1-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>com.restfb</groupId>
        <artifactId>restfb</artifactId>
        <version>1.6.11</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.5</version>
        <scope>testing</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.2</version>
    </dependency>

    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.1-901-1.jdbc4</version>
    </dependency>

    <!-- Route commons over slf -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>1.7.2</version>
        <scope>runtime</scope>
    </dependency>

    <!-- Use log4j as binding -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.2</version>
    </dependency>

</dependencies>

<repositories>

    <repository>
        <id>nexus</id>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <url>http://maven2.vantage.com:8080/repo/content/groups/public</url>
    </repository>

    <repository>
        <id>nexus-snapshots</id>
        <releases>
            <enabled>false</enabled>
        </releases>
        <url>http://maven2.vantage.com:8080/repo/content/groups/public</url>
    </repository>

</repositories>

<pluginRepositories>

    <pluginRepository>
        <id>nexus</id>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <url>http://maven2.vantage.com:8080/repo/content/groups/public</url>
    </pluginRepository>

    <pluginRepository>
        <id>nexus-snapshots</id>
        <releases>
            <enabled>false</enabled>
        </releases>
        <url>http://maven2.vantage.com:8080/repo/content/groups/public</url>
    </pluginRepository>

</pluginRepositories>

<distributionManagement>

    <!-- use the following if you ARE NOT deploying a snapshot version. -->
    <repository>
        <id>nexus</id>
        <name>Vantage Nexus Release Repository</name>
        <url>
            http://maven2.vantage.com:8080/repo/content/repositories/vantage-release
        </url>
    </repository>

    <!-- use the following if you ARE deploying a snapshot version. -->
    <snapshotRepository>
        <id>nexus-snapshot</id>
        <name>Vantage Nexus Snapshot Repository</name>
        <url>
            http://maven2.vantage.com:8080/repo/content/repositories/vantage-snapshot
        </url>
        <uniqueVersion>false</uniqueVersion>
    </snapshotRepository>

</distributionManagement>

<profiles>

    <profile>
        <id>env-development</id>
        <properties>
            <downloadSources>true</downloadSources>
            <downloadJavadocs>true</downloadJavadocs>
        </properties>
        <activation>
            <activeByDefault>true</activeByDefault>
            <property>
                <name>env</name>
                <value>development</value>
            </property>
        </activation>
    </profile>

</profiles>

`

当我运行时:mvn clean assembly:single它给出以下错误消息:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default-cli) on project iseek-content-fetcher-fb: Failed to create assembly: Failed to resolve dependencies for project: com.vantage.iseek.content:iseek-content-fetcher-fb:jar:1.0.1-SNAPSHOT: Missing: {
{1}} {
{1}} {
{1}} {
{1}} {
{1}} {
{1}} {
{1}} {
{1}} {
{1}} {
{1}} <登记/> [ERROR] ---------- {
{1}} {
{1}} {
{1}} {
{1}}
{{ 1}} {
{1}} {
{1}} {
{1}} {
{1}} {
{1}}
[ERROR] 1) com.vantage.iseek.content:iseek-content-publisher-ds:jar:1.0.1-SNAPSHOT {
{1}} {
{1}}

但是在目标目录中,当我运行[ERROR] 时,我总是找到iseek-content-fetcher-fb-1.0.1-SNAPSHOT.jar 有人可以指出我错过的东西吗?

1 个答案:

答案 0 :(得分:0)

好像你有一个maven-Projekt&#34; iseek-内容提取器-FB&#34;您正在进行的工作以及您在另一个本地项目中通过依赖项进行的引用。

Maven不会在eclipse目标文件夹中扫描你的项目。它只知道本地存储库中的maven-artifacts&#34;〜/ .m2&#34;或者像http://mvnrepository.com/这样的远程存储库。

您必须使用以下命令将maven项目编译并安装到本地存储库:mvn install

install - install the package into the local repository, for use as a dependency in other projects locally