Commit 2de23af5 authored by liaozan's avatar liaozan 🏀

chore: format

parent 285fe714
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -3,6 +3,7 @@ package com.schbrain.archetype.initializer.maven; ...@@ -3,6 +3,7 @@ package com.schbrain.archetype.initializer.maven;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ZipUtil; import cn.hutool.core.util.ZipUtil;
import com.schbrain.archetype.initializer.param.ArchetypeGenerateParam; import com.schbrain.archetype.initializer.param.ArchetypeGenerateParam;
import com.schbrain.common.util.JacksonUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.maven.cli.MavenCli; import org.apache.maven.cli.MavenCli;
...@@ -16,12 +17,19 @@ import java.io.File; ...@@ -16,12 +17,19 @@ import java.io.File;
public class MavenUtils { public class MavenUtils {
public static File generate(ArchetypeGenerateParam param) { public static File generate(ArchetypeGenerateParam param) {
MavenCli cli = new MavenCli(); log.info("Prepare to generate archetype project: {}", JacksonUtils.toJsonString(param, true));
System.getProperties().setProperty("maven.multiModuleProjectDirectory", "$M2_HOME");
MavenCli mavenCli = new MavenCli();
File archetype = getArchetypeDirectory(param.getArtifact()); File archetype = getArchetypeDirectory(param.getArtifact());
String[] args = getArgs(param, archetype.getAbsolutePath()); String outputDirectory = archetype.getAbsolutePath();
cli.doMain(args, null, System.out, System.err);
log.info("Generate archetype project at {}", archetype.getAbsolutePath()); String[] args = getArgs(param, outputDirectory);
System.getProperties().setProperty("maven.multiModuleProjectDirectory", "$M2_HOME");
mavenCli.doMain(args, null, System.out, System.err);
log.info("Generate archetype project at {}", outputDirectory);
return ZipUtil.zip(archetype); return ZipUtil.zip(archetype);
} }
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang=""> <html lang="zh">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta content="width=device-width,initial-scale=1.0" name="viewport">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link href="<%= BASE_URL %>favicon.ico" rel="icon">
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
</head> </head>
<body> <body>
<noscript> <noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -10,15 +10,4 @@ export default { ...@@ -10,15 +10,4 @@ export default {
BackendStarter BackendStarter
} }
} }
</script> </script>
\ No newline at end of file
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
\ No newline at end of file
<template> <template>
<div class="generate-form"> <div class="form">
<div class="generate-form-div "> <div class="form-div ">
<label for="input-packageName" class="generate-form-label">GitlabUrl</label> <label class="form-label" for="input-packageName">GitlabUrl</label>
<input id="input-gitlabUrl" class="generate-form-input" v-model="generateForm.gitlabUrl" <input id="input-gitlabUrl" v-model="form.gitlabUrl" class="form-input" type="text">
type="text">
</div> </div>
<div class="generate-form-div "> <div class="form-div ">
<label for="input-group" class="generate-form-label">Group</label> <label class="form-label" for="input-group">Group</label>
<input type="text" id="input-group" class="generate-form-input" v-model="generateForm.group"> <input id="input-group" v-model="form.group" class="form-input" type="text">
</div> </div>
<div class="generate-form-div "> <div class="form-div ">
<label for="input-artifact" class="generate-form-label">Artifact</label> <label class="form-label" for="input-artifact">Artifact</label>
<input type="text" id="input-artifact" class="generate-form-input" v-model="generateForm.artifact"> <input id="input-artifact" v-model="form.artifact" class="form-input" type="text">
</div> </div>
<div class="generate-form-div "> <div class="form-div ">
<label for="input-projectName" class="generate-form-label">Project Name</label> <label class="form-label" for="input-projectName">Project Name</label>
<input id="input-projectName" class="generate-form-input" v-model="generateForm.projectName" type="text"> <input id="input-projectName" v-model="form.projectName" class="form-input" type="text">
</div> </div>
<div class="generate-form-div "> <div class="form-div ">
<label for="input-packageName" class="generate-form-label">Package name</label> <label class="form-label" for="input-packageName">Package name</label>
<input type="text" id="input-packageName" class="generate-form-input" v-model="generateForm.packageName"> <input id="input-packageName" v-model="form.packageName" class="form-input" type="text">
</div> </div>
<input class="generate-form-submit" type="button" @click="submit" value="下载"> <input class="form-submit" type="button" value="下载" @click="submit">
</div> </div>
</template> </template>
...@@ -40,7 +38,7 @@ export default { ...@@ -40,7 +38,7 @@ export default {
name: "BackendStarter", name: "BackendStarter",
data() { data() {
return { return {
generateForm: { form: {
projectName: '', projectName: '',
gitlabUrl: '', gitlabUrl: '',
group: '', group: '',
...@@ -51,8 +49,7 @@ export default { ...@@ -51,8 +49,7 @@ export default {
}, },
methods: { methods: {
submit: function () { submit: function () {
axios.post('/archetype/generate', this.form, {
axios.post('/archetype/generate', this.generateForm, {
responseType: 'blob' responseType: 'blob'
}).then(res => { }).then(res => {
const {headers, data} = res const {headers, data} = res
...@@ -74,35 +71,35 @@ export default { ...@@ -74,35 +71,35 @@ export default {
<style scoped> <style scoped>
.generate-form { .form {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
max-width: 500px; max-width: 500px;
background: #FFF; background: #FFF;
padding: 30px 30px 20px 30px; padding: 30px 30px 20px 30px;
box-shadow: rgba(187, 187, 187, 1) 0 0px 20px -1px; box-shadow: rgba(187, 187, 187, 1) 0 0 20px -1px;
-webkit-box-shadow: rgba(187, 187, 187, 1) 0 0px 20px -1px; -webkit-box-shadow: rgba(187, 187, 187, 1) 0 0 20px -1px;
font: 12px Arial, Helvetica, sans-serif; font: 12px Arial, Helvetica, sans-serif;
color: #666; color: #666;
border-radius: 10px; border-radius: 10px;
-webkit-border-radius: 10px; -webkit-border-radius: 10px;
} }
.generate-form-div { .form-div {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 10px; margin-bottom: 10px;
} }
.generate-form-label { .form-label {
alignment: left; alignment: left;
width: 150px; width: 150px;
} }
.generate-form-input { .form-input {
color: #555; color: #555;
width: 100%; width: 100%;
padding: 3px 0px 3px 5px; padding: 3px 0 3px 5px;
margin-top: 2px; margin-top: 2px;
margin-right: 6px; margin-right: 6px;
margin-bottom: 16px; margin-bottom: 16px;
...@@ -113,7 +110,7 @@ export default { ...@@ -113,7 +110,7 @@ export default {
outline: 0; outline: 0;
} }
.generate-form-submit { .form-submit {
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ff5bb0), color-stop(1, #ef027d)); background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ff5bb0), color-stop(1, #ef027d));
border-radius: 9px; border-radius: 9px;
-webkit-border-radius: 9px; -webkit-border-radius: 9px;
...@@ -128,6 +125,6 @@ export default { ...@@ -128,6 +125,6 @@ export default {
width: 100px; width: 100px;
text-decoration: none; text-decoration: none;
text-align: center; text-align: center;
text-shadow: 1px 1px 0px #c70067; text-shadow: 1px 1px 0 #c70067;
} }
</style> </style>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment