Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
1458f93a
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1458f93a
编写于
3月 05, 2011
作者:
O
Olivier Lamy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FIXED JENKINS-8939] Fix for JENKINS-8711 breaks deployments with credentials
take care about using settings from the remote node
上级
f7dbe863
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
56 addition
and
14 deletion
+56
-14
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
...lugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
+2
-0
maven-plugin/src/main/java/hudson/maven/RedeployPublisher.java
...-plugin/src/main/java/hudson/maven/RedeployPublisher.java
+54
-14
未找到文件。
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
浏览文件 @
1458f93a
...
...
@@ -1088,6 +1088,8 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
else
{
this
.
privateRepository
=
null
;
}
// TODO maybe in goals with -s,--settings
// or -Dmaven.repo.local
this
.
alternateSettings
=
project
.
getAlternateSettings
();
this
.
mavenVersion
=
mavenVersion
;
this
.
resolveDependencies
=
project
.
isResolveDependencies
();
...
...
maven-plugin/src/main/java/hudson/maven/RedeployPublisher.java
浏览文件 @
1458f93a
...
...
@@ -24,15 +24,18 @@
package
hudson.maven
;
import
hudson.Extension
;
import
hudson.FilePath
;
import
hudson.Launcher
;
import
hudson.Util
;
import
hudson.maven.reporters.MavenAbstractArtifactRecord
;
import
hudson.model.AbstractBuild
;
import
hudson.model.AbstractProject
;
import
hudson.model.BuildListener
;
import
hudson.model.Computer
;
import
hudson.model.Hudson
;
import
hudson.model.Result
;
import
hudson.model.TaskListener
;
import
hudson.remoting.Callable
;
import
hudson.tasks.BuildStepDescriptor
;
import
hudson.tasks.BuildStepMonitor
;
import
hudson.tasks.Publisher
;
...
...
@@ -50,6 +53,7 @@ import java.util.Map.Entry;
import
net.sf.json.JSONObject
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.maven.artifact.Artifact
;
import
org.apache.maven.artifact.deployer.ArtifactDeploymentException
;
import
org.apache.maven.artifact.metadata.ArtifactMetadata
;
...
...
@@ -121,6 +125,7 @@ public class RedeployPublisher extends Recorder {
listener
.
getLogger
().
println
(
"Deploying artifacts to "
+
url
);
try
{
//MavenEmbedder embedder = MavenUtil.createEmbedder(listener,build);
MavenEmbedder
embedder
=
createEmbedder
(
listener
,
build
);
ArtifactRepositoryLayout
layout
=
(
ArtifactRepositoryLayout
)
embedder
.
lookup
(
ArtifactRepositoryLayout
.
ROLE
,
"default"
);
...
...
@@ -159,22 +164,57 @@ public class RedeployPublisher extends Recorder {
Properties
systemProperties
=
null
;
String
privateRepository
=
null
;
AbstractProject
project
=
build
.
getProject
();
if
(
project
instanceof
ProjectWithMaven
)
{
m
=
((
ProjectWithMaven
)
project
).
inferMavenInstallation
().
forNode
(
Hudson
.
getInstance
(),
listener
);
File
tmpSettings
=
File
.
createTempFile
(
"jenkins"
,
"temp-settings.xml"
);
try
{
AbstractProject
project
=
build
.
getProject
();
if
(
project
instanceof
ProjectWithMaven
)
{
m
=
((
ProjectWithMaven
)
project
).
inferMavenInstallation
().
forNode
(
Hudson
.
getInstance
(),
listener
);
}
if
(
project
instanceof
MavenModuleSet
)
{
profiles
=
((
MavenModuleSet
)
project
).
getProfiles
();
systemProperties
=
((
MavenModuleSet
)
project
).
getMavenProperties
();
// olamy see
// we have to take about the settings use for the project
// order tru configuration
// TODO maybe in goals with -s,--settings last wins but not done in during pom parsing
// or -Dmaven.repo.local
// if not wet must get ~/.m2/settings.xml
String
altSettingsPath
=
((
MavenModuleSet
)
project
).
getAlternateSettings
();
if
(
StringUtils
.
isBlank
(
altSettingsPath
)
)
{
// get userHome from the node where job has been executed
String
remoteUserHome
=
project
.
getSomeWorkspace
().
act
(
new
GetUserHome
()
);
altSettingsPath
=
remoteUserHome
+
".m2/settings.xml"
;
}
// we copy this file in the master in a temporary file
FilePath
filePath
=
new
FilePath
(
tmpSettings
);
FilePath
remoteSettings
=
project
.
getSomeWorkspace
().
child
(
altSettingsPath
);
if
(
remoteSettings
.
exists
())
{
remoteSettings
.
copyTo
(
filePath
);
settingsLoc
=
tmpSettings
;
}
}
return
MavenUtil
.
createEmbedder
(
new
MavenEmbedderRequest
(
listener
,
m
!=
null
?
m
.
getHomeDir
():
null
,
profiles
,
systemProperties
,
privateRepository
,
settingsLoc
));
}
finally
{
tmpSettings
.
delete
();
}
if
(
project
instanceof
MavenModuleSet
)
{
profiles
=
((
MavenModuleSet
)
project
).
getProfiles
();
systemProperties
=
((
MavenModuleSet
)
project
).
getMavenProperties
();
}
private
static
final
class
GetUserHome
implements
Callable
<
String
,
IOException
>
{
public
String
call
()
throws
IOException
{
return
System
.
getProperty
(
"user.home"
);
}
return
MavenUtil
.
createEmbedder
(
new
MavenEmbedderRequest
(
listener
,
m
!=
null
?
m
.
getHomeDir
():
null
,
profiles
,
systemProperties
,
privateRepository
,
settingsLoc
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录