在maven多模块项目中,我希望每个模块始终保持与父模块相同的版本,我通常在模块的pom.xml中执行以下操作:
<parent>
<groupId>com.groupId</groupId>
<artifactId>parentArtifactId</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<groupId>com.groupId</groupId>
<artifactId>artifactId</artifactId>
<packaging>jar</packaging>
<version>${project.parent.version}</version>
<name>name</name>
Run Code Online (Sandbox Code Playgroud)
自从我开始使用maven 3.0-alpha-5以来,我收到了以下警告.
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.groupid.artifactId:name:jar:1.1-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ com.groupid.artifactId:name::${project.parent.version}, /Users/whaley/path/to/project/child/pom.xml
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
Run Code Online (Sandbox Code Playgroud)
我很想知道将模块的版本绑定到父版本的真正问题是,如果有的话?或者这是一个一般警告的情况,当任何表达式,无论是否是project.parent.version,用于版本元素.
使用svn:ignore属性,有没有一种方法可以根据我不想忽略的模式指定我想要忽略的内容?换句话说,我想忽略除了 .xyz结尾的文件之外的所有内容.我该怎么做呢(如果可能的话)?
我探索的一个选项是提交我想要版本化的所有内容,然后将目录上的svn:ignore属性设置为'*',这意味着没有其他文件,但我已经提交的内容将被版本化.这是我能想到的最好的,但它感觉很脏,如果我确实需要添加另一个文件作为版本,我必须进行多次提交...一个删除svn:ignore属性,另一个添加/提交新文件,然后第三个更改svn:忽略回'*'.
你的意见?
在maven 2.x中,如何在命令行中设置插件的属性,而不是在pom或settings.xml中的该插件的<configuration>中设置?
例如,如果我正在使用mvn dependency:copy-dependencies(在此处看到),如何在不触及pom或my settings.xml的情况下设置useRepositoryLayout属性?
谢谢!
我刚刚遇到了一个我的maven项目的两个直接依赖项的情况,它有两个不同版本的特定传递依赖项.
在我的特定情况下,我直接依赖于以下内容:
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-sshj</artifactId>
<version>${jclouds.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
和
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-jersey</artifactId>
<version>${mule.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这两个依赖关系都对com.sun.jersey:jersey-core有一个(深层)传递依赖,但每个依赖关系都有不同的版本.Maven没有对此失败,甚至发出警告(或者如果有的话,我从未见过它!)这样的事情正在发生......因此我从未注意到它直到调试发生在版本的球衣时发生的问题 - 由jclouds依赖带来的核心导致一些事情破裂.
是否存在maven插件或其他一些工具,它会检测到这种深度传递依赖性覆盖,并且至少警告用户(或者maven执行失败)如果它检测到这样的冲突......即使默认的maven行为是只选择解决依赖项时出现的第一个版本?
我正处于scala的第二个晚上,我正在抵制用scala写东西的冲动,我曾经在java中做过这些,并试图学习所有的习语.在这种情况下,我希望只使用闭包,映射和列表理解这样的东西来计算平均值.无论这是否是计算平均值的最佳方法,我只想知道如何在scala中执行这些操作仅用于学习目的
这是一个例子:下面的平均方法几乎没有实现.我有几个其他的方法来查找个人用户ID给出的评级使用TraversableLike的查找方法(我认为),但没有更多的是scala特定的,真的.我如何计算给定List [RatingEvent]的平均值,其中RatingEvent.rating是一个双值,我将以类似scala的方式计算该List的所有值的平均值?
package com.brinksys.liftnex.model
class Movie(val id : Int, val ratingEvents : List[RatingEvent]) {
def getRatingByUser(userId : Int) : Int = {
return getRatingEventByUserId(userId).rating
}
def getRatingEventByUserId(userId : Int) : RatingEvent = {
var result = ratingEvents find {e => e.userId == userId }
return result.get
}
def average() : Double = {
/*
fill in the blanks where an average of all ratingEvent.rating values is expected
*/
return 3.8
}
}
Run Code Online (Sandbox Code Playgroud)
经验丰富的scala pro如何填充该方法并使用scala的功能使其尽可能简洁?我知道如何在java中这样做,这是我想要避免的.
如果我在python中这样做,我认为最pythonic的方式是:
sum([re.rating. for re in …Run Code Online (Sandbox Code Playgroud) 考虑到我加入的团队是如何使用SVN的,这是一个奇怪的问题.基本上,svn存储库遵循标准布局,但是干线确实在1.5年左右没有被触及,并且工作往往仅在分支的分支和分支中发生.因此,我使用git-svn从代表我们下一个版本的活动分支的分支进行克隆,这就是我本地git存储库中的主跟踪.让我们从这里开始在svn'release'中调用这个分支.为此目的使用git-svn只是笨拙的dory.
现在,有人已经创建了一个"发布"功能分支,我将称之为"功能",我想要下载到我的本地分支,并承诺.当然,我可以在本地克隆该分支到另一个目录/ git存储库,但我真正想做的是在我的本地git存储库中的本地分支中镜像"feature"以便在这两个人尽可能地直截了当.我已经看到其他stackoverflow.com帖子显示这是如何工作的假设你已经使用git svn init过--stdlayout,但由于上述原因我没有这样做.
这是我的.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[svn-remote "svn"]
url = https://our.svn.server/svn/root/branches/release
fetch = :refs/remotes/git-svn
Run Code Online (Sandbox Code Playgroud)
我假设在我的[svn-remote]部分中我需要的是一个branches = $something但是我不知道在这种情况下是什么东西是什么,也不知道在我对.git/config进行更改后我需要git checkout和其他命令的咒语.
有什么建议?
编辑 - 以下工作:
所以我从头开始并执行以下克隆命令:
git svn clone https://my.svn.server/svn/root -T branches/branch_I_want_as_master -b branches
大约16个小时之后,最终将所有东西都拉下来了.结果.git/config看起来像这样:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[svn-remote "svn"]
url = https://my.svn.server/svn/root
fetch = branches/branch_I_want_as_master:refs/remotes/trunk
branches = branches/*:refs/remotes/*
Run Code Online (Sandbox Code Playgroud)
所以我知道这有效 - 我可以 …
我的一位同事有一个我想要克隆的远程git仓库,他提供了一个git@his.server.com的网址:443/repo.git.在这种情况下,ssh列在端口443上.
我尝试克隆, git clone git@his.server.com:443/repo.git但操作超时.我曾经认为git默认为ssh作为其协议,我不知道为什么这不起作用.
如果我在url中明确指定ssh就像git clone ssh://git@his.server.com:443/repo.git它正常工作一样.
这是预期的git行为吗?为什么第一个网址不起作用,但第二个网址不起作用?
ActiveMQ/JMS具有内置机制,用于确保在使用竞争使用者模式时,共享公共标头(即JMSXGroupID标头)的消息始终由队列的同一使用者使用.队列的使用者完全不知道实际的头部值,因为具有公共头部的消息的保证是在服务器端而不是消费者端执行的.有关其工作原理的更多详细信息,请参阅http://activemq.apache.org/message-groups.html.
使用AMQP或RabbitMQ特定的东西可以做到这一点吗?
快速简介我的情况 - 我正在开发一个代码库,它有JAX-WS带注释的接口/类,我们从中生成代码优先的wsdls.我们正在使用CXF的cxf-java2ws-plugin在maven内构建时生成wsdl,以包含在为每个模块生成的.jar中.
我们想要做的是将这些wsdl文件部署到maven存储库,因为maven存储库可以充当
到目前为止我所拥有的是一个使用依赖项的pom文件:unpack-dependencies将项目中的所有wsdl文件放入此模块中的一个目录$ {project.build.directory}(通常称为target/to每个人都在那里).
我不知道该怎么做是遍历每个文件并在每个wsdl上调用deploy:deploy-file mojo.我有什么选择,因为我真的想要自动化部署这些wsdl文件的过程而没有任何人手动部署它们?
为了完整起见,这是pom文件:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>rice</artifactId>
<groupId>org.kuali.rice</groupId>
<version>2.0.0-m7-SNAPSHOT</version>
</parent>
<artifactId>rice-dist-wsdl</artifactId>
<name>Rice WSDL Distributions</name>
<packaging>pom</packaging>
<properties>
<wsdl.location>${project.build.directory}/wsdl</wsdl.location>
</properties>
<!-- Depends on all API modules and modules that generate or contain wsdls -->
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-core-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-kew-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-kim-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-krms-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-ksb-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-shareddata-api</artifactId> …Run Code Online (Sandbox Code Playgroud) 我在http://rayninfo.co.uk/vimtips.html上发生了这个充满了超级有用且相当神秘的vim技巧的页面.我已经尝试了其中的一些,我理解发生了什么,足以能够在我脑海中正确地解析它,以便我以后可以重新创建它.一个我很难让我的脑袋缠绕,但是以下两个命令可以从每一行的末尾删除所有空格
:%s= *$== : delete end of line blanks
:%s= \+$== : Same thing
Run Code Online (Sandbox Code Playgroud)
我正在解释%s文件中每一行的字符串替换,但之后我迷失了看起来像s和regex的一些粗略变化.我习惯于看到和使用:s/regex/replacement.但上述情况令人困惑.
以上命令在英语中是什么意思,一步一步?