【问题标题】:Error Build in maven [duplicate]Maven中的错误构建[重复]
【发布时间】:2013-12-22 23:12:56
【问题描述】:

我写了

mvn -f pom.xml compile exec:java -Dexec.classpathScope=Compile-Dexec.main Class=storm.starter.WordCountTopology 

这是错误

[INFO] One or more required plugin parameters are invalid/missing for 'exec:java'

这是 pom.xml 中的内容

<project 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>
      <groupId>storm.starter</groupId>
      <artifactId>storm-starter</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>jar</packaging>
      <name>storm-starter</name>
      <url>https://github.com/nathanmarz/storm-starter</url>

      <properties>
           <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>
      <repositories>
         <repository>
              <id>github-releases</id> 
              <url>http://oss.sonatype.org/content/repositories/github-releases/</url>   
         </repository>
         <repository>
              <id>clojars.org</id>
              <url>http://clojars.org/repo</url>
         </repository>
      </repositories>
            <dependencies>
                <dependency>
                   <groupId>junit</groupId>
                   <artifactId>junit</artifactId>
                   <version>3.8.1</version>
                   <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.testng</groupId>
                    <artifactId>testng</artifactId>
                    <version>6.8.5</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.mockito</groupId>
                    <artifactId>mockito-all</artifactId>
                    <version>1.9.0</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                     <groupId>org.easytesting</groupId>
                     <artifactId>fest-assert-core</artifactId>
                     <version>2.0M8</version>
                     <scope>test</scope>
                </dependency>
                <dependency>
                     <groupId>org.jmock</groupId>
                     <artifactId>jmock</artifactId>
                     <version>2.6.0</version>
                     <scope>test</scope>
                </dependency>
                <dependency>
                     <groupId>storm</groupId>
                     <artifactId>storm</artifactId>
                     <version>0.9.0.1</version>
                     <!-- keep storm out of the jar-with-dependencies-->                  
                     <scope>provided</scope>
                </dependency>
                <dependency>
                     <groupId>commons-collections</groupId>
                     <artifactId>commons-collections</artifactId> 
                     <version>3.2.1</version>
                </dependency>
                <dependency>
                     <groupId>com.google.guava</groupId>
                     <artifactId>guava</artifactId>
                     <version>15.0</version>
                </dependency>
           </dependencies>
           <build>
               <sourceDirectory>src/jvm</sourceDirectory> 
               <testSourceDirectory>test/jvm</testSourceDirectory>
               <resources>
                   <resource>
                      <directory>${basedir}/multilang</directory>
                   </resource>
               </resources>
               <plugins>
               <!-- Bind the maven-assembly-plugin to the package phase this will create a jar file without the storm dependencies suitable for deployment to a cluster.-->
                   <plugin>
                      <artifactId>maven-assembly-plugin</artifactId>
                      <configuration>
                          <descriptorRefs>
                               <descriptorRef>jar-with-dependencies</descriptorRef>         
                          </descriptorRefs>
                          <archive>
                               <manifest>
                                   <mainClass/>
                               </manifest>
                          </archive>
                       </configuration>
                       <executions>
                          <execution>
                              <id>make-assembly</id>
                              <phase>package</phase>
                              <goals>
                                 <goal>single</goal>
                              </goals>
                          </execution>
                       </executions>
                     </plugin>
                    <plugin>
                       <groupId>com.theoryinpractise</groupId>
                       <artifactId>clojure-maven-plugin</artifactId> 
                       <version>1.3.12</version>
                       <extensions>true</extensions>
                       <configuration>
                            <sourceDirectories> 
                                <sourceDirectory>src/clj</sourceDirectory> 
                            </sourceDirectories>
                       </configuration>
                     <executions>
                         <execution>
                             <id>compile</id>
                             <phase>compile</phase>
                             <goals>
                                <goal>compile</goal>
                             </goals>
                     </execution>
                     <execution>
                             <id>test</id>
                             <phase>test</phase>
                             <goals>
                                 <goal>test</goal>
                             </goals>
                     </execution>
                   </executions>
             </plugin>
             <plugin>
                   <groupId>org.codehaus.mojo</groupId>
                   <artifactId>exec-maven-plugin</artifactId>
                   <version>1.2.1</version>
                   <executions>
                         <execution>
                               <goals>
                                  <goal>exec</goal>
                               </goals>
                         </execution>
                   </executions>
                   <configuration>
                         <executable>java</executable> 
                         <includeProjectDependencies>true</includeProjectDependencies> 
                         <includePluginDependencies>false</includePluginDependencies> 
                         <classpathScope>compile</classpathScope> 
                         <mainClass>${storm.topology}</mainClass>
                   </configuration>
                </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                 </configuration>
             </plugin>
          </plugins>
     </build>

【问题讨论】:

  • 更多调试信息,如果你使用 -X 选项。
  • 如果您已逐字粘贴命令行,请尝试不同的间距:mvn -f pom.xml compile exec:java -Dexec.classpathScope=compile -Dexec.mainClass=storm.starter.WordCountTopology
  • 我试过你写的这个命令,但还是同样的问题
  • 我是 maven 的新手,你的意思是 -x 那个 mvn -X 吗?
  • [INFO] 'exec:java' 的一个或多个必需的插件参数无效/缺失 [0] 在插件 'exec-maven-plugin' 的定义中指定以下内容: 。 .. VALUE -OR- 在命令行上,指定:'-Dstorm.topology=VALUE

标签: java maven apache-storm


【解决方案1】:

您的 POM 看起来如何?您需要包含 Exec 插件,以便您的 POM 看起来像这样:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2.1</version>
        <executions>
          <execution>
            ...
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <executable>maven</executable>
          <!-- optional -->
          <workingDirectory>/tmp</workingDirectory>
          <arguments>
            <argument>-X</argument>
            <argument>myproject:dist</argument>
            ...
          </arguments>
        </configuration>
      </plugin>
    </plugins>
  </build>
   ...
</project>

(Source)

【讨论】:

  • 我在我的帖子中发布了 pom.xml 的内容。谢谢
  • 请编辑您的 POM,它不可读。
  • 这里是我的 pom.xml 2shared.com/document/yZPU74go/pom.html的链接
  • Rcs,问题还存在吗?
  • @tucuxi 是的,它还在!
猜你喜欢
  • 1970-01-01
  • 2011-07-10
  • 2014-01-27
  • 2022-01-13
  • 2011-12-09
  • 2023-03-26
  • 1970-01-01
  • 2014-10-05
相关资源
最近更新 更多