在IDE中构建并运行良好:
cd /home/thufir/NetBeansProjects/HelloMaven; JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 /home/thufir/.local/share/umake/ide/netbeans/java/maven/bin/mvn "-Dexec.args=-classpath %classpath net.bounceme.dur.hello_maven.Main" -Dexec.executable=/usr/lib/jvm/java-8-openjdk-amd64/bin/java process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
Scanning for projects...
------------------------------------------------------------------------
Building HelloMaven 1.0-SNAPSHOT
------------------------------------------------------------------------
--- maven-resources-plugin:2.5:resources (default-resources) @ HelloMaven ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 0 resource
--- maven-compiler-plugin:2.3.2:compile (default-compile) @ HelloMaven ---
Compiling 1 source file to /home/thufir/NetBeansProjects/HelloMaven/target/classes
--- exec-maven-plugin:1.2.1:exec (default-cli) @ HelloMaven ---
Oct 21, 2017 10:21:38 AM net.bounceme.dur.hello_maven.Main getGreeting
INFO: Hello world.
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1.994s
Finished at: Sat Oct 21 10:21:38 PDT 2017
Final Memory: 10M/153M
------------------------------------------------------------------------
但在“CLI”中失败:
thufir@dur:~/NetBeansProjects/HelloMaven$
thufir@dur:~/NetBeansProjects/HelloMaven$ mvn clean deploy -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building HelloMaven 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ HelloMaven ---
[INFO] Deleting /home/thufir/NetBeansProjects/HelloMaven/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ HelloMaven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ HelloMaven ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/thufir/NetBeansProjects/HelloMaven/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ HelloMaven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/thufir/NetBeansProjects/HelloMaven/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ HelloMaven ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ HelloMaven ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ HelloMaven ---
[INFO] Building jar: /home/thufir/NetBeansProjects/HelloMaven/target/HelloMaven-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ HelloMaven ---
[INFO] Installing /home/thufir/NetBeansProjects/HelloMaven/target/HelloMaven-1.0-SNAPSHOT.jar to /home/thufir/.m2/repository/com/mycompany/HelloMaven/1.0-SNAPSHOT/HelloMaven-1.0-SNAPSHOT.jar
[INFO] Installing /home/thufir/NetBeansProjects/HelloMaven/pom.xml to /home/thufir/.m2/repository/com/mycompany/HelloMaven/1.0-SNAPSHOT/HelloMaven-1.0-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ HelloMaven ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.353 s
[INFO] Finished at: 2017-10-21T10:22:23-07:00
[INFO] Final Memory: 14M/49M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project HelloMaven: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project HelloMaven: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
at org.apache.maven.plugin.deploy.DeployMojo.getDeploymentRepository(DeployMojo.java:235)
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:118)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
thufir@dur:~/NetBeansProjects/HelloMaven$
最简单的项目:
thufir@dur:~/NetBeansProjects/HelloMaven$
thufir@dur:~/NetBeansProjects/HelloMaven$ tree
.
├── nbactions.xml
├── pom.xml
└── src
├── main
│ ├── java
│ │ └── net
│ │ └── bounceme
│ │ └── dur
│ │ └── hello_maven
│ │ └── Main.java
│ └── resources
└── test
└── java
10 directories, 3 files
thufir@dur:~/NetBeansProjects/HelloMaven$
这里是pom.xml
:
thufir@dur:~/NetBeansProjects/HelloMaven$
thufir@dur:~/NetBeansProjects/HelloMaven$ cat pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>com.mycompany</groupId>
<artifactId>HelloMaven</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>thufir@dur:~/NetBeansProjects/HelloMaven$
如何从CLI构建和运行这个项目?
类似于:
Maven:运行程序的生命周期阶段?
您的错误消息说exec-maven-plugin找不到主类。您的pom似乎没有将其列为插件。对于完整的包名称,不包括src.main.java,只需从域开始。通常是com、org等。
我有一个maven项目,我正在Intellij IDEA中导入它。除了部署maven项目控制台时显示以下错误外,一切都很好 [ERROR]未能执行goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy(default-deploy)on project multisite:Deployment Failed:在distributio
我有一个模块化maven项目。在最高层,我有: 我已经尝试了我能想到的一切: 重新执行项目, 清理所有eclipse相关文件, 清理本地maven存储库, 正在清理服务器tmp文件夹并重新添加项目, 更新并安装maven 到目前为止没有任何帮助。 我有一个令人震惊的发现:我添加了一个名为“amodule”的模块。你猜怎么着,它得到了所需的罐子而其他的没有。似乎只有按字母顺序排列的第一个模块获得ja
问题内容: 我正在尝试从Maven内部执行繁琐的任务,而无需安装Node.js或任何东西。这是因为我不想将我的工件由Jenkins打包,也无法在该机器上安装Node.js。 我知道使用npm很容易,并且有一些命令可以使它正常工作,但是我也认为与maven集成应该很容易,问题是我不知道从哪里开始,因为我是npm的新手。 问题答案: 是的,使用frontend-maven-plugin,您可以通过Ma
我是一名Azure新手,试图以自动CI/CD方式安装WebApp。 如果我在CLI shell中登录,我可以通过 az webapp部署源配置--name${webapp_name}--资源组${RESOURCEGROUP_name}--插槽暂存--repo url${GIT_url}--分支${branch}--手动集成 我想使用Jenkins中的shell(不使用Azure插件)来实现这一点。
我有这个错误,我试图解决它,但我不能。 组织。素面。扩展。组成部分格哈特。GChartRenderer'缺少一个运行时依赖项:java。lang.NoClassDefFoundError:com/google/gson/GsonBuilder 错误[org.jboss.msc.service.fail](ServerService线程池--64)MSC000001:无法开启服务jboss.unde
公用 模型 存储库 服务 网站 我们搜索了一下,没有找到一个解决方案,当项目具有这种结构时,如何制作一个可执行的jar。 下面是父pom.xml: 有人使用Spring Boot、Maven插件和Maven模块项目结构创建了可执行的fat jar吗?