当我尝试编译为Java App时,我遇到了一个问题,因为它找不到该类。
在搜索网页后,堆栈溢出后,我发现我必须将类复制到类路径中,但正如您在图片中看到的那样,我没有那个依赖项,或者我的项目中的那个类。
图片中显示:
Error image + maven dependency
这是我的pom.xml:
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.6.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
<scope>compile</scope>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<version>2.3.3</version>
<inherited>true</inherited>
<configuration>
<download>true</download>
<schemaDirectory>src/main/resources</schemaDirectory>
<sourceGenerationDirectory>src/main/java</sourceGenerationDirectory>
<classGenerationDirectory>target/classes</classGenerationDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>package-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>se.sigma.educational.Main</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>target/generated-sources/axis2/wsdl2code/resources</directory>
</resource>
<resource>
<directory>target/generated-sources/xmlbeans/resources</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
(&lt; / dependencies&gt;标签已添加但未在此处显示)。
想告诉你,那个课程已经进入这个课程,但我不确定我是否可以使用它:
我作为maven build运行,之后我运行maven install,此时一切正常(构建成功),但是当我尝试从主类调用它时,我得到了错误。
如果您需要更多信息,请直接询问。