我需要一些帮助来尝试使用命令行运行以下maven项目:https://github.com/sarxos/webcam-capture,webcam-capture-qrcode示例就是我正在尝试运行的那个。我使用Eciplse IDE运行它,但需要将其转移到只使用命令行。我有一个由maven创建的罐子。
我在努力
java -classpath ./webcam-capture/target/webcam-capture-0.3.10-SNAPSHOT.jar com.github.sarxos.webcam.WebcamQRCodeExample 但我一直收到
Exception in thread "main" java.lang.NoClassDefFoundError: com/github/sarxos/webcam/WebcamQRCodeExample
Caused by: java.lang.ClassNotFoundException: com.github.sarxos.webcam.WebcamQRCodeExample发布于 2014-04-21 18:23:35
第一步:在pom.xml中添加此内容
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>第二步:逐行执行此命令。
cd /go/to/myApp
mvn clean
mvn compile
mvn package
java -cp target/myApp-0.0.1-SNAPSHOT.jar go.to.myApp.select.file.to.executehttps://stackoverflow.com/questions/15869784
复制相似问题