我正在为一个大小合适的Web项目设置集成测试模块.集成测试模块与Web项目本身是分开的,它有自己的pom.
我们的想法是使用maven-soapui-plugin发送请求并验证响应.设置soapui-plugin并不麻烦.但是,我在弄清楚如何告诉jetty-maven-plugin从远程存储库部署战争时遇到了麻烦.
如果我理解正确,jetty-maven-plugin有一个名为'<webApp>/<webApp>'的属性,它允许我指定要部署的war文件.问题是war文件本身不存在war文件.
我听说我可以使用maven程序集插件通过项目artifactId从存储库中检索战争,但我还没弄清楚我将如何去做.
这是我想要的总结:
我很确定我已经完成了第3步,但我不确定如何实现第1步和第2步.
任何帮助是极大的赞赏
maven-2 soapui pom.xml maven-assembly-plugin maven-jetty-plugin
我花了无数个小时试图解决这个问题,但我仍然在黑暗中,希望有人可以伸出援助之手.这是我的情况:
(finalName)somename.$ {var1} - $ {var2}(/ finalName) - >我在文件名元素周围使用括号,因为我不能在这个编辑器中使用括号.
这些$ {var1}和$ {var2}在外部.properties文件中定义.要阅读这些变量,我正在使用properties-maven-plugin.我无法在pom中定义这些变量,因为它们针对每个部署进行了更改,并且无法从cmd行提供.当我运行mvn assembly:single时,zip工件创建为somename.null-null.zip.看起来.properties文件中定义的属性为null或未被计算.当我在调试模式下运行mvn时,我看到资源设置正确:var1 = something和var2 = somethingelse.他们都有正确的价值观.我现在正处于亏损状态.任何帮助将不胜感激.
我正在努力将项目从Ant迁移到Maven.我需要提供的最终发行版是一个包含可执行jar的zip,其中包含所有依赖性.这是我的pom的一部分:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-4</version>
<configuration>
<finalName>ProjectDistribution</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>fullQualifiedNameToMainClass</mainClass>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<descriptors>
<descriptor>${project.basedir}/src/main/assembly/dep.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
<execution>
<id>dist</id>
<phase>assembly</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
这是汇编文件:
<assembly>
<id>dist</id>
<formats>
<format>zip</format>
</formats>
<!-- 1st approach-->
<!--files>
<file>
<source>
/target/ProjectDistribution.jar
</source>
<outputDirectory>/</outputDirectory>
</file>
</files-->
<fileSets>
<!-- 2nd approach-->
<!--fileSet>
<directory>/target</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet-->
<fileSet>
<directory>/HelpFiles</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*.*</include>
</includes>
</fileSet>
</fileSets>
Run Code Online (Sandbox Code Playgroud)
我运行1.- mvn compile,2.- mvn package和3.- mvn …
如果你能帮助我找出这个问题,我会很愉快的.
当我使用maven < assembly >插件将项目构建到.zip时.
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>dev</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${basedir}</directory>
<includes>
<include>/environments/dev/**/*.sh</include>
<include>/environments/dev/**/*.jil</include>
<include>/environments/dev/**/*.properties</include>
<include>/environments/dev/**/log4j2.xml</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
Run Code Online (Sandbox Code Playgroud)
我收到以下文件结构:
build.zip----> environments__
|_DEV_
|_bin
|_properties
|_....
Run Code Online (Sandbox Code Playgroud)
我的目标是:
要在maven构建之后获得以下文件结构:
build.zip---->
|_bin
|_properties
|_....
Run Code Online (Sandbox Code Playgroud)
没有环境和DEV文件夹.
我已经阅读了maven文档(http://maven.apache.org/plugins/maven-assembly-plugin/advanced-descriptor-topics.html),我们可以排除一些文件目录.这条路:
<assembly>
....
<fileSets>
<fileSet>
<directory>${basedir}</directory>
<includes>
....
</includes>
<excludes>
<exclude>/environments/dev</exclude>
</excludes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
Run Code Online (Sandbox Code Playgroud)
但它没有帮助.我还有以前的文件结构.
我试图从我的 Maven 构建中排除一个资源文件。我复制了 my-jar-with-dependencies.xml 并添加了一个部分。这正确地排除了命名文件被复制到 jar 的 /src/main/resources但文件仍然与其他资源一起被复制到 jar 的顶级目录。
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<!-- TODO: a jarjar format would be better -->
<id>my-jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory></outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<excludes>
<exclude>**/lanchecker.properties</exclude> <!-- this removes it from jar/src/main/resources but *NOT* from jar/ -->
</excludes>
</fileSet>
</fileSets>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
Run Code Online (Sandbox Code Playgroud)
我可以阻止 maven-assembly-plugin 执行该复制操作,但仍然可以在开发中访问该文件吗?
更新:
依赖项,根据要求:
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId> …Run Code Online (Sandbox Code Playgroud) 我有一个maven项目,有一个主项目A和模块B和C。子项目继承自A的pom。
A
|
|----B
| |----pom.xml
|
|----C
| |----pom.xml
|
|----pom.xml
Run Code Online (Sandbox Code Playgroud)
它已经为所有模块构建了 jar。有没有办法将依赖项包含在这些 jar 中?例如,我得到B-1.0-with-dependencies.jar并且C-1.0-with-dependencies.jar?我尝试过设置
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
在父 pom 中,但它似乎没有做任何事情:构建成功,但我得到常规的、无依赖项的 jar。
我想避免在每个子 pom 中放入一些东西,因为实际上我有两个以上的模块。我确信有某种方法可以做到这一点,但似乎无法从 Maven 文档中解决。谢谢!
是否可以使用现有的"Generic"原型创建特定于应用程序的原型?
通用原型 - 将包含通用文件夹和配置文件等.将现有原型扩展为子原型.
通用原型--->特定应用程序原型(保留应用程序特定文件夹..)
通用原型--->特定应用程序原型1
每次使用特定于应用程序的原型创建项目时,都应检查Generic archetype中的新更新.
我是akka的新手,请帮助我。在运行可执行jar时,出现错误:无法将替换值替换为$ akka.stream-blocking io调度程序
我正在尝试将maven模块中的特定目录添加到我的构建中.我相信这是回归的方法.
我将非常感谢使用从maven模块获取必要目录的简洁明了的方法,这些模块只包含一个包含一些必要资源的目录.
谢谢,麻烦您了.
GC
我正试图在我的应用程序中覆盖Akka配置.我为应用程序创建了额外的lib,它还有application.conf文件,因为它使用了Akka.所以我有两个:
application.conf in my lib:
my-conf {
something = 1
}
application.conf in my app, which uses the lib:
something-else = "foo"
my-conf {
something = 1000
}
Run Code Online (Sandbox Code Playgroud)
当我从Intellij Idea运行应用程序时,一切都很好,并且正在覆盖lib配置.要在我的应用程序中加载配置,我正在使用简单的ConfigFactory.load()操作.但是,当我创建一个我的应用程序的jar mvn clean compile assembly:single并尝试使用此命令运行它时:java -Xmx4048m -XX:MaxPermSize=512M -Xss256K -classpath myApp.jar com.myapp.example.MyMain我收到错误:
Caused by: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'something-else'
Run Code Online (Sandbox Code Playgroud)
所以我决定在我的应用程序中重命名conf文件,并以这种方式加载它:
val defConfig = ConfigFactory load
val myConfig = ConfigFactory load "myconf"
val combined = myConfig.withFallback(defConfig)
val config = ConfigFactory load combined
Run Code Online (Sandbox Code Playgroud)
它发现缺少设置,但遗憾的是我的应用程序中的配置不会覆盖我的lib中的配置.在我的lib中,我以默认方式加载配置:val settings …
maven ×6
java ×4
maven-plugin ×3
akka ×2
maven-2 ×2
jar ×1
multi-module ×1
pom.xml ×1
soapui ×1