在Windows 7上,我试图将maven-3命令的输出发送到文本文件.
我从我试图分析的项目的根目录中调用命令.
命令是:
mvn dependency:tree -Dverbose -Dincludes=commons-collections -DoutputFile=C:\Users\myname\Documents\output.txt
Run Code Online (Sandbox Code Playgroud)
当我在没有outputFile
参数的情况下运行命令时,我看到发送到控制台的输出.
但是当我将它与outputFile
参数一起使用时,输出文件为空.
知道我在这里缺少什么吗?
我有一个依赖项,我想在test
范围内使用(因此它在运行单元测试时在类路径中),并且在runtime
范围内(这样我可以在WAR/EAR /其他包装中包含它用于部署,但不影响依赖工件的传递依赖查找).
一个真实的例子是SLF4J的实现JAR(例如Logback
).我希望它在运行测试时存在于类路径中,并且我希望它包含在我的WAR/EAR中,但我不希望项目依赖于我的项目将其包含在传递依赖项查找中.
我尝试使用,<scope>test,runtime</scope>
但Maven 3发出警告:
[WARNING] 'dependencies.dependency.scope' for org.slf4j:jcl-over-slf4j:jar
must be one of [provided, compile, runtime, test, system] but is 'test,runtime'.
Run Code Online (Sandbox Code Playgroud)
在这种情况下,声明依赖范围的正确方法是什么?
我有一个Web应用程序,我们可以在功能准备就绪时部署到生产环境,有时可能每天运行几次,有时可能需要几周时间才能发布.
目前,我们没有为我们的项目增加我们的版本号,而且所有版本都在版本中0.0.1-SNAPSHOT
保存了一年多.我想知道为Web应用程序进行持续交付的Maven方式是什么.在每次提交时提高版本号并且从不像我们现在所做的那样碰撞版本号似乎有点过分,似乎也是错误的.
对于此类Maven使用,建议的最佳做法是什么?
问题实际上是双重问题:
pom.xml
文件中推进项目版本号(可以有很多).java continuous-integration maven-3 maven continuous-delivery
今天我尝试了最新的jdk9 Build 113,并尝试使用最新的Maven 3.3.9 编译我的项目
这些是命令(部分通过twitter发现)
export MVN_OPTS="-Dmaven.compiler.fork -Dmaven.compiler.executable=/somewhere/Downloads/jdk-9/bin/javac"
export JAVA_HOME="/somewhere/Downloads/jdk-9"
mvn clean install
Run Code Online (Sandbox Code Playgroud)
但是我得到了这个错误 ......简而言之:
[WARNING] Error injecting: org.codehaus.plexus.archiver.jar.JarArchiver
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(java.base@9-ea/Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(java.base@9-ea/NativeConstructorAccessorImpl.java:62)
...
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.<clinit>(AbstractZipArchiver.java:116)
... 89 more
[WARNING] Error injecting: org.apache.maven.plugin.jar.JarMojo
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(java.base@9-ea/Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(java.base@9-ea/NativeConstructorAccessorImpl.java:62)
...
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.<clinit>(AbstractZipArchiver.java:116)
... 89 more
Run Code Online (Sandbox Code Playgroud)
什么是正确的maven配置或用于JDK9的参数?
$ mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /home/somewhere/Downloads/maven …
Run Code Online (Sandbox Code Playgroud) Maven 3 beta已经推出几周了,我只是想了解Maven 3的功能列表.因为对我来说,只添加了两个主要功能
其他一切似乎都是错误修复或小改进.所以你怎么看?Maven 3值得等待吗?
制作战争文件的简便方法是什么?
当我右键单击在服务器上运行时,我的项目正在工作,但我想部署在tomcat服务器上.我已安装,m2clipse
但它给了我一个错误.
我是否需要特殊的目录结构来与eclipse进行战争?
无法执行目标org.apache.maven.plugins:maven-war-plugin:2.1.1:war(default-war)项目测试2:组装WAR时出错:需要webxml属性(或预先存在的WEB-INF/web .xml如果在更新模式下执行) - > [帮助1] [错误]
我在IntelliJ,JDK1.8,maven 3.2.5中使用maven.编译错误:使用-source 7或更高版本启用钻石歌剧.详情如下:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] TrainingConstructor.java:[31,55] diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator)
[ERROR] DTM.java:[79,21] try-with-resources is not supported in -source 1.5 (use -source 7 or higher to enable try-with-resources)
[ERROR] ticons.java:[53,44] diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator)
Run Code Online (Sandbox Code Playgroud)
有什么建议?是否有其他配置来设置此-source级别?好像它不使用java 1.8.
我正在使用maven和eclipse m2e配置一个多模块父子maven项目,我正在使用来自eclipse Juno SR1的最新资料,即m2e 1.2.0
父pom使用enforcer插件,因此父pom.xml在其插件部分中具有以下内容
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.1.1</version>
<executions>
<!-- Enforce that all versions of a transative dependency must converge. -->
<execution>
<id>enforce</id>
<configuration>
<rules>
<DependencyConvergence />
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
<!-- Black list certain jars -->
<execution>
<id>enforce-banned-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<exclude>
commons-logging:commons-logging
</exclude>
</excludes>
</bannedDependencies>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
每个子项目都有一条错误消息说 maven-enforcer-plugin (goal "enforce") is ignored by m2e.
我正在使用Maven 3.1.1.在我的一个项目中,我引用了我的另一个项目......
<dependencies>
<dependency>
<groupId>org.mainco.subco</groupId>
<artifactId>myprojectA</artifactId>
<version>${project.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
以上内容取决于我的其他几个项目.但是,当我运行"mvn clean install"时,Maven会尝试下载这些工件而不是仅仅使用我本地存储库中的内容.如果我的本地存储库中不存在Maven,我如何让它只下载?这是我所看到的输出......
davea$ mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building subco admin Module 57.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://download.java.net/maven/2/org/mainco/subco/myprojectA/57.0.0-SNAPSHOT/maven-metadata.xml
Downloading: http://download.java.net/maven/2/org/mainco/subco/subco/57.0.0-SNAPSHOT/maven-metadata.xml
Downloading: http://download.java.net/maven/2/org/mainco/subco/projectB/57.0.0-SNAPSHOT/maven-metadata.xml
Downloading: http://download.java.net/maven/2/org/mainco/subco/projectC/57.0.0-SNAPSHOT/maven-metadata.xml
[INFO]
Run Code Online (Sandbox Code Playgroud) 从一些程序集插件版本maven build开始发出以下警告:
[警告]程序集描述符包含一个filesystem-root相对引用,它不是跨平台兼容的/
是否有任何推荐的即用型解决方案?直接谷歌搜索为我提供了大量的垃圾,没有真正的帮助.重新检查Maven程序集插件帮助没有为我提供答案,也许其他人有更好的搜索技能,可以提供帮助.
UPDATE
是的,这可能是因为类似于Linux,outputDirectory
但我应该如何重写它以便携带?查看程序集插件文档,但未找到任何可移植性指南.
<fileSets>
<fileSet>
<directory>${basedir}/src/main/resources</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
Run Code Online (Sandbox Code Playgroud)