Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
0fcf658c
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,发现更多精彩内容 >>
提交
0fcf658c
编写于
12月 11, 2010
作者:
O
Olivier Lamy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[HUDSON-4988] Maven 3 support in maven-plugin
fixing missing wagon providers
上级
478c0c43
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
89 addition
and
44 deletion
+89
-44
maven-agent/src/main/java/hudson/maven/agent/Main.java
maven-agent/src/main/java/hudson/maven/agent/Main.java
+6
-0
maven-plugin/pom.xml
maven-plugin/pom.xml
+13
-0
maven-plugin/src/main/java/hudson/maven/ExecutedMojo.java
maven-plugin/src/main/java/hudson/maven/ExecutedMojo.java
+1
-1
maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
+5
-5
maven-plugin/src/main/java/hudson/maven/MavenBuild.java
maven-plugin/src/main/java/hudson/maven/MavenBuild.java
+1
-1
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
...lugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
+3
-0
maven-plugin/src/main/java/hudson/maven/MavenUtil.java
maven-plugin/src/main/java/hudson/maven/MavenUtil.java
+38
-31
maven3-listener/src/main/java/org/jvnet/hudson/maven3/listeners/HudsonMavenBuildHelper.java
...jvnet/hudson/maven3/listeners/HudsonMavenBuildHelper.java
+5
-6
pom.xml
pom.xml
+17
-0
未找到文件。
maven-agent/src/main/java/hudson/maven/agent/Main.java
浏览文件 @
0fcf658c
...
...
@@ -278,6 +278,12 @@ public class Main {
URLClassLoader
orig
=
(
URLClassLoader
)
Thread
.
currentThread
().
getContextClassLoader
();
System
.
out
.
println
(
"orig "
+
orig
.
toString
());
URL
cl
=
orig
.
getResource
(
"org/apache/maven/plugin/PluginManager.class"
);
if
(
cl
!=
null
)
{
System
.
out
.
println
(
"cl "
+
cl
.
toString
());
}
// org.apache.maven.plugin.PluginManager
try
{
launcher
.
setAppMain
(
"org.apache.maven.cli.MavenCli"
,
"plexus.core.maven"
);
...
...
maven-plugin/pom.xml
浏览文件 @
0fcf658c
...
...
@@ -115,6 +115,19 @@ THE SOFTWARE.
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.apache.maven.wagon
</groupId>
<artifactId>
wagon-http-lightweight
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.maven.wagon
</groupId>
<artifactId>
wagon-file
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.maven.wagon
</groupId>
<artifactId>
wagon-provider-api
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.maven.reporting
</groupId>
<artifactId>
maven-reporting-api
</artifactId>
...
...
maven-plugin/src/main/java/hudson/maven/ExecutedMojo.java
浏览文件 @
0fcf658c
...
...
@@ -80,7 +80,7 @@ public final class ExecutedMojo implements Serializable {
*/
public
final
String
digest
;
ExecutedMojo
(
MojoInfo
mojo
,
long
duration
)
throws
IOException
,
InterruptedException
{
public
ExecutedMojo
(
MojoInfo
mojo
,
long
duration
)
throws
IOException
,
InterruptedException
{
this
.
groupId
=
mojo
.
pluginName
.
groupId
;
this
.
artifactId
=
mojo
.
pluginName
.
artifactId
;
this
.
version
=
mojo
.
pluginName
.
version
;
...
...
maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
浏览文件 @
0fcf658c
...
...
@@ -54,15 +54,12 @@ import org.apache.maven.execution.ExecutionListener;
import
org.apache.maven.execution.MavenSession
;
import
org.apache.maven.plugin.Mojo
;
import
org.apache.maven.plugin.MojoExecution
;
import
org.apache.maven.plugin.PluginConfigurationException
;
import
org.apache.maven.plugin.PluginContainerException
;
import
org.apache.maven.plugin.PluginParameterExpressionEvaluator
;
import
org.apache.maven.project.MavenProject
;
import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator
;
import
org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration
;
import
org.jvnet.hudson.maven3.agent.Maven3Main
;
import
org.jvnet.hudson.maven3.launcher.Maven3Launcher
;
import
org.jvnet.hudson.maven3.listeners.HudsonMavenBuildHelper
;
import
org.jvnet.hudson.maven3.listeners.HudsonMavenExecutionResult
;
/**
...
...
@@ -279,10 +276,13 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
return
null
;
}
// FIME really used somewhere ???
// FIXME MojoInfo need the real mojo ??
// so tricky to do need to use MavenPluginManager on the current Maven Build
// so tricky to do
.
need to use MavenPluginManager on the current Maven Build
private
Mojo
getMojo
(
MojoExecution
mojoExecution
,
MavenSession
mavenSession
)
{
return
null
;
/*
try
{
return HudsonMavenBuildHelper.getMavenPluginManager().getConfiguredMojo( Mojo.class, mavenSession,
...
...
@@ -295,7 +295,7 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
catch ( PluginConfigurationException e )
{
throw new RuntimeException( e.getMessage(), e );
}
}
*/
}
private
ExpressionEvaluator
getExpressionEvaluator
(
MavenSession
session
,
MojoExecution
mojoExecution
)
...
...
maven-plugin/src/main/java/hudson/maven/MavenBuild.java
浏览文件 @
0fcf658c
...
...
@@ -410,7 +410,7 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> {
}
}
class
ProxyImpl2
extends
ProxyImpl
implements
MavenBuildProxy2
{
public
class
ProxyImpl2
extends
ProxyImpl
implements
MavenBuildProxy2
{
private
final
SplittableBuildListener
listener
;
long
startTime
;
private
final
OutputStream
log
;
...
...
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
浏览文件 @
0fcf658c
...
...
@@ -597,6 +597,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
}
else
{
Builder
builder
=
new
Builder
(
slistener
,
proxies
,
project
.
sortedActiveModules
,
margs
.
toList
(),
envVars
);
MavenProbeAction
mpa
=
null
;
try
{
...
...
@@ -819,6 +820,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
}
@Override
void
preBuild
(
MavenSession
session
,
ReactorManager
rm
,
EventDispatcher
dispatcher
)
throws
BuildFailureException
,
LifecycleExecutionException
,
IOException
,
InterruptedException
{
// set all modules which are not actually being build (in incremental builds) to NOT_BUILD
...
...
@@ -1044,6 +1046,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
MavenEmbedder
embedder
=
MavenUtil
.
createEmbedder
(
listener
,
mavenHome
.
getHomeDir
(),
profiles
,
properties
,
privateRepository
,
settingsLoc
);
MavenProject
mp
=
embedder
.
readProject
(
pom
);
Map
<
MavenProject
,
String
>
relPath
=
new
HashMap
<
MavenProject
,
String
>();
MavenUtil
.
resolveModules
(
embedder
,
mp
,
getRootPath
(
rootPOMRelPrefix
),
relPath
,
listener
,
nonRecursive
);
...
...
maven-plugin/src/main/java/hudson/maven/MavenUtil.java
浏览文件 @
0fcf658c
...
...
@@ -210,38 +210,45 @@ public class MavenUtil {
* errors will be reported to the listener and the exception thrown.
* @throws MavenEmbedderException
*/
public
static
void
resolveModules
(
MavenEmbedder
embedder
,
MavenProject
project
,
String
rel
,
Map
<
MavenProject
,
String
>
relativePathInfo
,
BuildListener
listener
,
boolean
nonRecursive
)
throws
ProjectBuildingException
,
AbortException
,
MavenEmbedderException
{
public
static
void
resolveModules
(
MavenEmbedder
embedder
,
MavenProject
project
,
String
rel
,
Map
<
MavenProject
,
String
>
relativePathInfo
,
BuildListener
listener
,
boolean
nonRecursive
)
throws
ProjectBuildingException
,
AbortException
,
MavenEmbedderException
{
File
basedir
=
project
.
getFile
().
getParentFile
();
relativePathInfo
.
put
(
project
,
rel
);
if
(!
nonRecursive
)
{
List
<
MavenProject
>
modules
=
new
ArrayList
<
MavenProject
>();
for
(
String
modulePath
:
(
List
<
String
>)
project
.
getModules
())
{
if
(
Util
.
fixEmptyAndTrim
(
modulePath
)!=
null
)
{
File
moduleFile
=
new
File
(
basedir
,
modulePath
);
if
(
moduleFile
.
exists
()
&&
moduleFile
.
isDirectory
())
{
moduleFile
=
new
File
(
basedir
,
modulePath
+
"/pom.xml"
);
}
if
(!
moduleFile
.
exists
())
throw
new
AbortException
(
moduleFile
+
" is referenced from "
+
project
.
getFile
()+
" but it doesn't exist"
);
String
relativePath
=
rel
;
if
(
relativePath
.
length
()>
0
)
relativePath
+=
'/'
;
relativePath
+=
modulePath
;
MavenProject
child
=
embedder
.
readProject
(
moduleFile
);
resolveModules
(
embedder
,
child
,
relativePath
,
relativePathInfo
,
listener
,
nonRecursive
);
modules
.
add
(
child
);
}
}
project
.
setCollectedProjects
(
modules
);
}
relativePathInfo
.
put
(
project
,
rel
);
if
(
!
nonRecursive
)
{
List
<
MavenProject
>
modules
=
new
ArrayList
<
MavenProject
>();
for
(
String
modulePath
:
(
List
<
String
>)
project
.
getModules
()
)
{
if
(
Util
.
fixEmptyAndTrim
(
modulePath
)
!=
null
)
{
File
moduleFile
=
new
File
(
basedir
,
modulePath
);
if
(
moduleFile
.
exists
()
&&
moduleFile
.
isDirectory
()
)
{
moduleFile
=
new
File
(
basedir
,
modulePath
+
"/pom.xml"
);
}
if
(
!
moduleFile
.
exists
()
)
throw
new
AbortException
(
moduleFile
+
" is referenced from "
+
project
.
getFile
()
+
" but it doesn't exist"
);
String
relativePath
=
rel
;
if
(
relativePath
.
length
()
>
0
)
relativePath
+=
'/'
;
relativePath
+=
modulePath
;
MavenProject
child
=
embedder
.
readProject
(
moduleFile
);
resolveModules
(
embedder
,
child
,
relativePath
,
relativePathInfo
,
listener
,
nonRecursive
);
modules
.
add
(
child
);
}
}
project
.
setCollectedProjects
(
modules
);
}
}
/**
...
...
maven3-listener/src/main/java/org/jvnet/hudson/maven3/listeners/HudsonMavenBuildHelper.java
浏览文件 @
0fcf658c
...
...
@@ -22,10 +22,8 @@ package org.jvnet.hudson.maven3.listeners;
import
javax.inject.Inject
;
import
org.apache.maven.plugin.MavenPluginManager
;
import
org.codehaus.plexus.PlexusContainer
;
import
org.codehaus.plexus.component.annotations.Component
;
import
org.codehaus.plexus.component.repository.exception.ComponentLookupException
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
;
...
...
@@ -39,7 +37,7 @@ public class HudsonMavenBuildHelper implements Initializable
// must be available in a static way weird
// and not really good design !
private
static
MavenPluginManager
mavenPluginManager
;
//
private static MavenPluginManager mavenPluginManager;
@Inject
private
PlexusContainer
plexusContainer
;
...
...
@@ -47,6 +45,7 @@ public class HudsonMavenBuildHelper implements Initializable
public
void
initialize
()
throws
InitializationException
{
/*
try
{
mavenPluginManager = plexusContainer.lookup( MavenPluginManager.class );
...
...
@@ -55,12 +54,12 @@ public class HudsonMavenBuildHelper implements Initializable
{
throw new InitializationException(e.getMessage(), e);
}
*/
}
public
static
MavenPluginManager
getMavenPluginManager
()
/*
public static MavenPluginManager getMavenPluginManager()
{
return mavenPluginManager;
}
}
*/
}
pom.xml
浏览文件 @
0fcf658c
...
...
@@ -299,6 +299,22 @@ THE SOFTWARE.
<artifactId>
aether-connector-wagon
</artifactId>
<version>
${aetherVersion}
</version>
</dependency>
<dependency>
<groupId>
org.apache.maven.wagon
</groupId>
<artifactId>
wagon-http-lightweight
</artifactId>
<version>
${wagonVersion}
</version>
</dependency>
<dependency>
<groupId>
org.apache.maven.wagon
</groupId>
<artifactId>
wagon-file
</artifactId>
<version>
${wagonVersion}
</version>
</dependency>
<dependency>
<groupId>
org.apache.maven.wagon
</groupId>
<artifactId>
wagon-provider-api
</artifactId>
<version>
${wagonVersion}
</version>
</dependency>
<dependency>
<groupId>
org.sonatype.sisu
</groupId>
<artifactId>
sisu-inject-plexus
</artifactId>
...
...
@@ -326,6 +342,7 @@ THE SOFTWARE.
<mavenVersion>
3.0.1
</mavenVersion>
<maven.version>
${mavenVersion}
</maven.version>
<aetherVersion>
1.8
</aetherVersion>
<wagonVersion>
1.0-beta-6
</wagonVersion>
<!-- *.html files are in UTF-8, and *.properties are in iso-8859-1, so this configuration is acturally incorrect,
but this suppresses a warning from Maven, and as long as we don't do filtering we should be OK. -->
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录