为什么我的jar文件和我的.war文件不能在我的项目构建中找到? Maven的 [英] Why can't my jar files and my .war file be found within my project build? Maven

查看:200
本文介绍了为什么我的jar文件和我的.war文件不能在我的项目构建中找到? Maven的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我尝试使用此命令在本地测试我的Maven应用程序:

Ok so I'm trying to test my Maven app locally with this command:

java -jar target / dependency / jetty-runner.jar target / *。战争

java -jar target/dependency/jetty-runner.jar target/*.war

但我收到此错误:

无法访问jarfile目标/依赖/ jetty- runner.jar。

"Unable to access jarfile target/dependency/jetty-runner.jar."

它似乎也无法访问我的.war文件。我不知道发生了什么事。我尝试手动下载jetty-runner.jar文件并将我的项目导出到战争中,然后从我的桌面运行命令,这两个文件所在的位置,这是有效的。所以找到这些文件会有问题。

It also can't seem to access my .war file. I don't know what's going on. I tried manually downloading the jetty-runner.jar file and exporting my project into a war, and then running the command from my desktop where the two files were located, and that worked. So it's gotta be a problem with finding these files.

我发现代码在线。什么是目标/依赖文件夹?为什么我的码头跑者不在那里?它也无法在目标中找到 .war文件。我知道这个原因我使用手动下载的jetty-runner.jar与target / .war并且它仍然失败了:

I found that code online. What is the target/dependency folder? Why isn't my jetty-runner there? It is also unable to find the .war file in target. I know this cause I used my manually downloaded jetty-runner.jar with target/.war and it still failed with this:

java.net。 MalformedURLException:没有协议:target / * war

"java.net.MalformedURLException: no protocol: target/*war"

我确实在我的pom.xml中包含了jetty-runner:

I did include the jetty-runner in my pom.xml:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
    <execution>
        <phase>package</phase>
        <goals><goal>copy</goal></goals>
        <configuration>
            <artifactItems>
                <artifactItem>
                    <groupId>org.mortbay.jetty</groupId>
                    <artifactId>jetty-runner</artifactId>
                    <version>7.4.5.v20110725</version>
                    <destFileName>jetty-runner.jar</destFileName>
                </artifactItem>
            </artifactItems>
        </configuration>
    </execution>
</executions>

那是什么给出的?这个目标文件夹是什么?为什么找不到任何东西?谢谢!

So what gives? What is this target folder? and why can't anything be found? Thanks!

推荐答案

解决了它,不得不运行:

Solved it, had to run:

mvn包

或者在我的情况下,我在eclipse中将我的项目作为Maven Build ...运行并输入package到目标中。这将文件放在必要的地方

or in my case, I ran my project as Maven Build... in eclipse and typed "package" into goal. This put the files in the necessary places

这篇关于为什么我的jar文件和我的.war文件不能在我的项目构建中找到? Maven的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆