【问题标题】:Error in Maven buildingMaven构建中的错误
【发布时间】:2014-01-19 06:35:10
【问题描述】:

我是 Maven 新手

Maven构建时出现此错误

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".   
SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J:
See http://www.slf4j.org/codes.html#StaticLoggerBinder for further
details. [INFO] Scanning for projects
[INFO] BUILD FAILURE [INFO]
[INFO] Total time: 4.973s [INFO] Finished at: Sun Jan 19 08:17:30 EET 2014 
[INFO] Final Memory: 3M/7M
[INFO][ERROR] No goals have been specified for this build. You must specify
a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal>
or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>.
Available lifecycle phases are: validate, initialize,
generate-sources

有什么帮助吗?

这是我的 pom.xml

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

        <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>
            <dependency>
                <groupId>org.yaml</groupId>
                <artifactId>snakeyaml</artifactId>
                <version>1.6</version>
            </dependency>
        </dependencies>

        <build>

            <finalName>${project.artifactId}</finalName>
            <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></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>
                    <version>2.3.2</version>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>
</pre>

【问题讨论】:

  • 你能分享你的pom.xml 和你正在运行的命令行吗?
  • 我使用 IDE eclipse 运行它。运行 AS..>Maven Build。我现在添加 pom.xml

标签: maven clojure


【解决方案1】:

如果您使用 Run as->Maven Build,那么您必须在对话框中的“目标”字段中指定特定目标,例如 installpackage 并运行。

如果它不能解决您的问题,请尝试在命令行中运行它,一旦给出mvn clean install 命令并查看结果。

更多here

【讨论】:

  • 我的帖子的前三行是什么?目标是应该让我选择安装还是打包,还是我会写?因为当我按下目标并选择时,我没有找到任何可以选择它的东西,并且出现此错误 [错误] 无法在以下位置找到 Javac 编译器:/usr/lib/jvm/jre1.6.0_38/../lib/tools .jar 请确保您使用的是 JDK 1.4 或更高版本,而不是 JRE(需要 com.sun.tools.javac.Main 类)
  • @user3188912 :前三行是什么,我没听懂。关于目标,它会打开一个对话框询问目标,你已经进入安装/包并运行它,如果它没有显示它,那么去运行配置并添加目标。
  • 我的意思是这个 SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder”。 SLF4J:默认为无操作(NOP)记录器实现 SLF4J:请参阅slf4j.org/codes.html#StaticLoggerBinder 了解更多
  • @user3188912 那是关于logger的配置,即slf4j配置不正确,与maven build无关
  • 感谢阿拉我解决了。问题出在 tools.jar 我添加了外部 jar 并手动添加了
猜你喜欢
  • 2011-07-10
  • 2022-01-13
  • 2011-12-09
  • 2023-03-26
  • 2014-10-05
  • 2021-08-04
  • 2017-01-11
  • 1970-01-01
相关资源
最近更新 更多