error在maven中构建

g9icjywg  于 2021-06-24  发布在  Storm
关注(0)|答案(1)|浏览(403)

这个问题在这里已经有了答案

maven building出错(1个答案)
7年前关门了。
我写道

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>
bis0qfac

bis0qfac1#

你的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>

(来源)

相关问题