Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
comtainer-plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaoaiqing
comtainer-plugin
Commits
c98d5df8
Commit
c98d5df8
authored
Aug 01, 2018
by
qiaokun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除临时web.xml文件由deleteOnExit方法切换到delete方法
parent
0e6905af
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
Bootstrap.java
.../java/com/cesgroup/tomcat/plugin/bootstrap/Bootstrap.java
+16
-9
No files found.
src/main/java/com/cesgroup/tomcat/plugin/bootstrap/Bootstrap.java
View file @
c98d5df8
...
...
@@ -22,7 +22,6 @@ import java.io.File;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.jar.JarFile
;
public
class
Bootstrap
implements
Container
{
...
...
@@ -41,20 +40,25 @@ public class Bootstrap implements Container {
private
String
context
;
public
Bootstrap
()
{
this
(
System
.
getProperty
(
"user.dir"
),
webapp
,
webapp
,
"destWork"
);
}
public
Bootstrap
(
String
originRoot
)
{
this
(
originRoot
,
webapp
,
webapp
,
"destWork"
);
}
public
Bootstrap
(
String
originRoot
,
String
destRoot
)
{
this
(
originRoot
,
webapp
,
destRoot
,
"destWork"
);
}
public
Bootstrap
(
String
originRoot
,
String
webapp
,
String
destRoot
,
String
destDirectory
)
{
//设置默认context为当前项目名称
String
projectPath
=
System
.
getProperty
(
"user.dir"
);
File
temp
=
new
File
(
projectPath
);
this
.
context
=
temp
.
getName
();
this
.
projectPath
=
originRoot
;
this
.
originWebappFile
=
new
File
(
projectPath
,
webapp
);
...
...
@@ -64,7 +68,7 @@ public class Bootstrap implements Container {
clearAndCompile
(
originWebappFile
,
destDirectoryFile
);
this
.
monitor
(
originWebappFile
.
getAbsolutePath
(),
new
FileListener
(
originWebappFile
.
getAbsolutePath
(),
this
.
destDirectoryFile
.
getAbsolutePath
()));
}
else
{
}
else
{
this
.
destDirectoryFile
=
this
.
originWebappFile
;
}
}
...
...
@@ -111,14 +115,17 @@ public class Bootstrap implements Container {
final
String
testclasses
=
new
File
(
projectPath
,
"target/test-classes"
).
getAbsolutePath
();
final
File
webXml
=
new
File
(
testclasses
,
"web.xml"
);
final
File
webXml
=
new
File
(
testclasses
,
"web.xml"
);
webXml
.
deleteOnExit
();
if
(
webXml
.
exists
())
{
webXml
.
delete
();
}
FileUtils
.
copyURLToFile
(
getClass
().
getResource
(
"/web.xml"
),
webXml
);
FileUtils
.
copyURLToFile
(
getClass
().
getResource
(
"/web.xml"
),
webXml
);
Tomcat
tomcat
=
new
Tomcat
()
{
@Override
public
Context
addWebapp
(
Host
host
,
String
url
,
String
name
,
String
path
)
{
...
...
@@ -131,7 +138,7 @@ public class Bootstrap implements Container {
ContextConfig
ctxCfg
=
new
ContextConfig
();
ctx
.
addLifecycleListener
(
ctxCfg
);
ctxCfg
.
setDefaultWebXml
(
new
File
(
testclasses
,
"web.xml"
).
getPath
());
ctxCfg
.
setDefaultWebXml
(
new
File
(
testclasses
,
"web.xml"
).
getPath
());
if
(
host
==
null
)
{
getHost
().
addChild
(
ctx
);
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment