├── settings.gradle
├── img
├── start.png
├── third.png
├── second.png
├── demoApplication.png
├── generateService.png
├── mybatisExample.png
├── generateProvider.png
├── generateTestCase.png
├── projectStructure.png
└── generatedProperties.png
├── src
├── test
│ ├── resources
│ │ ├── project
│ │ │ ├── custom
│ │ │ │ └── custom.txt
│ │ │ ├── kotlin
│ │ │ │ ├── spring-boot-2.0
│ │ │ │ │ ├── DemoApplication.kt.gen
│ │ │ │ │ ├── DemoApplicationLegacy.kt.gen
│ │ │ │ │ └── ServletInitializer.kt.gen
│ │ │ │ ├── standard
│ │ │ │ │ ├── DemoApplication.kt.gen
│ │ │ │ │ ├── ServletInitializer.kt.gen
│ │ │ │ │ ├── DemoApplicationTests.kt.gen
│ │ │ │ │ ├── DemoApplicationTestsWeb.kt.gen
│ │ │ │ │ ├── build.gradle.gen
│ │ │ │ │ └── pom.xml.gen
│ │ │ │ ├── spring-boot-1.4
│ │ │ │ │ ├── DemoApplicationTests.kt.gen
│ │ │ │ │ └── ServletInitializer.kt.gen
│ │ │ │ └── war
│ │ │ │ │ ├── build.gradle.gen
│ │ │ │ │ └── pom.xml.gen
│ │ │ ├── groovy
│ │ │ │ ├── standard
│ │ │ │ │ ├── DemoApplication.groovy.gen
│ │ │ │ │ ├── ServletInitializer.groovy.gen
│ │ │ │ │ ├── DemoApplicationTests.groovy.gen
│ │ │ │ │ ├── DemoApplicationTestsWeb.groovy.gen
│ │ │ │ │ ├── build.gradle.gen
│ │ │ │ │ └── pom.xml.gen
│ │ │ │ ├── spring-boot-1.4
│ │ │ │ │ ├── DemoApplicationTests.groovy.gen
│ │ │ │ │ └── ServletInitializer.groovy.gen
│ │ │ │ ├── spring-boot-2.0
│ │ │ │ │ └── ServletInitializer.groovy.gen
│ │ │ │ └── war
│ │ │ │ │ ├── build.gradle.gen
│ │ │ │ │ └── pom.xml.gen
│ │ │ ├── java
│ │ │ │ ├── standard
│ │ │ │ │ ├── DemoApplication.java.gen
│ │ │ │ │ ├── ServletInitializer.java.gen
│ │ │ │ │ ├── DemoApplicationTests.java.gen
│ │ │ │ │ ├── DemoApplicationTestsWeb.java.gen
│ │ │ │ │ ├── build.gradle.gen
│ │ │ │ │ └── pom.xml.gen
│ │ │ │ ├── spring-boot-1.4
│ │ │ │ │ ├── DemoApplicationTests.java.gen
│ │ │ │ │ └── ServletInitializer.java.gen
│ │ │ │ ├── spring-boot-2.0
│ │ │ │ │ └── ServletInitializer.java.gen
│ │ │ │ └── war
│ │ │ │ │ ├── build.gradle.gen
│ │ │ │ │ └── pom.xml.gen
│ │ │ ├── maven
│ │ │ │ ├── gitignore.gen
│ │ │ │ ├── version-override-pom.xml.gen
│ │ │ │ ├── compile-only-dependency-pom.xml.gen
│ │ │ │ ├── bom-property-pom.xml.gen
│ │ │ │ ├── bom-ordering-pom.xml.gen
│ │ │ │ ├── kotlin-java6-pom.xml.gen
│ │ │ │ ├── kotlin-java7-pom.xml.gen
│ │ │ │ ├── kotlin-java9-pom.xml.gen
│ │ │ │ ├── kotlin-springboot2-pom.xml.gen
│ │ │ │ └── kotlin-springboot2-legacy-pom.xml.gen
│ │ │ └── gradle
│ │ │ │ ├── gitignore.gen
│ │ │ │ ├── version-override-build.gradle.gen
│ │ │ │ ├── compile-only-dependency-build.gradle.gen
│ │ │ │ ├── bom-property-build.gradle.gen
│ │ │ │ ├── bom-ordering-build.gradle.gen
│ │ │ │ ├── kotlin-java6-build.gradle.gen
│ │ │ │ ├── kotlin-java7-build.gradle.gen
│ │ │ │ ├── kotlin-java9-build.gradle.gen
│ │ │ │ ├── kotlin-springboot2-build.gradle.gen
│ │ │ │ └── kotlin-springboot2-legacy-build.gradle.gen
│ │ ├── templates
│ │ │ └── custom.txt
│ │ ├── application-test-custom-defaults.yml
│ │ ├── application-test-custom-env.yml
│ │ ├── metadata
│ │ │ ├── config
│ │ │ │ ├── test-repository.json
│ │ │ │ ├── test-bom.json
│ │ │ │ └── test-min.json
│ │ │ └── sagan
│ │ │ │ ├── spring-boot.json
│ │ │ │ └── spring-boot-no-default.json
│ │ └── application-test-default.yml
│ └── java
│ │ └── com
│ │ └── bruce
│ │ └── dubboplugin
│ │ ├── TemplateRenderTest.java
│ │ └── GenerateUtilsTest.java
└── main
│ ├── resources
│ ├── templates
│ │ ├── starter-settings.gradle
│ │ ├── DemoService.java
│ │ ├── DemoService.kt
│ │ ├── boot-cli-capabilities.txt
│ │ ├── Application.groovy
│ │ ├── DemoServiceImpl.kt
│ │ ├── ServletInitializer.kt
│ │ ├── ServletInitializer.groovy
│ │ ├── ServletInitializer.java
│ │ ├── schema.sql
│ │ ├── httpie-examples.txt
│ │ ├── ApplicationTests.groovy
│ │ ├── DemoServiceImpl.java
│ │ ├── curl-examples.txt
│ │ ├── ApplicationTests.kt
│ │ ├── ApplicationTests.java
│ │ ├── gitignore.tmpl
│ │ ├── TestModelMapper.java
│ │ ├── TestModelService.java
│ │ ├── Application.java
│ │ ├── cli-capabilities.txt
│ │ ├── parent-pom.xml
│ │ ├── README.md
│ │ ├── starter-pom-api.xml
│ │ ├── TestModel.java
│ │ ├── Application.kt
│ │ ├── application.properties
│ │ ├── MapperTest.java
│ │ ├── .gitignore.txt
│ │ ├── starter-build.gradle
│ │ └── TestModelMapper.xml
│ ├── img
│ │ └── dubbo_icon.png
│ ├── project
│ │ ├── maven
│ │ │ ├── wrapper
│ │ │ │ ├── maven-wrapper.jar
│ │ │ │ └── maven-wrapper.properties
│ │ │ └── mvnw.cmd
│ │ ├── gradle
│ │ │ ├── gradle
│ │ │ │ └── wrapper
│ │ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ │ └── gradle-wrapper.properties
│ │ │ ├── gradlew.bat
│ │ │ └── gradlew
│ │ ├── gradle3
│ │ │ ├── gradle
│ │ │ │ └── wrapper
│ │ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ │ └── gradle-wrapper.properties
│ │ │ ├── gradlew.bat
│ │ │ └── gradlew
│ │ └── gradle4
│ │ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ ├── gradlew.bat
│ │ │ └── gradlew
│ └── META-INF
│ │ └── plugin.xml
│ └── java
│ └── com
│ └── bruce
│ └── dubboplugin
│ ├── dto
│ ├── PreConfig.java
│ ├── GenerateContentContext.java
│ ├── UserChooseDependency.java
│ ├── DependencyConstant.java
│ └── Dependency.java
│ ├── helper
│ ├── IconUtils.java
│ ├── CommonUtils.java
│ ├── DependencyHelper.java
│ └── TemplateRenderer.java
│ ├── form
│ ├── ChooseDubboConfigurationStep.form
│ └── ChooseDubboConfigurationStep.java
│ └── DubboPluginModuleBuilder.java
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── README.md
├── .idea
├── vcs.xml
├── copyright
│ ├── profiles_settings.xml
│ └── Apache2.xml
├── kotlinc.xml
├── compiler.xml
├── misc.xml
├── dataSources.xml
└── modules
│ ├── dubboPlugin_main.iml
│ └── dubboPlugin_test.iml
├── mylicense
└── header.txt
├── .gitignore
├── gradlew.bat
├── README_CN.md
└── gradlew
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'dubboPlugin'
2 |
3 |
--------------------------------------------------------------------------------
/img/start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/img/start.png
--------------------------------------------------------------------------------
/img/third.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/img/third.png
--------------------------------------------------------------------------------
/img/second.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/img/second.png
--------------------------------------------------------------------------------
/src/test/resources/project/custom/custom.txt:
--------------------------------------------------------------------------------
1 | Custom resources
2 |
3 | com.example.custom
4 | 42
--------------------------------------------------------------------------------
/src/test/resources/templates/custom.txt:
--------------------------------------------------------------------------------
1 | Custom resources
2 |
3 | {{groupId}}
4 | {{customValue}}
--------------------------------------------------------------------------------
/img/demoApplication.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/img/demoApplication.png
--------------------------------------------------------------------------------
/img/generateService.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/img/generateService.png
--------------------------------------------------------------------------------
/img/mybatisExample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/img/mybatisExample.png
--------------------------------------------------------------------------------
/img/generateProvider.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/img/generateProvider.png
--------------------------------------------------------------------------------
/img/generateTestCase.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/img/generateTestCase.png
--------------------------------------------------------------------------------
/img/projectStructure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/img/projectStructure.png
--------------------------------------------------------------------------------
/img/generatedProperties.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/img/generatedProperties.png
--------------------------------------------------------------------------------
/src/main/resources/templates/starter-settings.gradle:
--------------------------------------------------------------------------------
1 | package templates
2 |
3 | rootProject.name = '{{artifactId}}'
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # This project has migrated to https://github.com/dubbo/intellij-idea-plugin
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/main/resources/img/dubbo_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/src/main/resources/img/dubbo_icon.png
--------------------------------------------------------------------------------
/src/main/resources/templates/DemoService.java:
--------------------------------------------------------------------------------
1 | package {{dubboPackageName}};
2 |
3 | public interface {{serviceSimpleName}} {
4 |
5 | String sayHello(String name);
6 |
7 | }
--------------------------------------------------------------------------------
/src/main/resources/templates/DemoService.kt:
--------------------------------------------------------------------------------
1 | package {{dubboPackageName}};
2 |
3 | interface {{serviceSimpleName}} {
4 |
5 | fun sayHello(name: String): String
6 |
7 | }
--------------------------------------------------------------------------------
/src/main/resources/project/maven/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/src/main/resources/project/maven/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/src/main/resources/project/maven/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip
2 |
--------------------------------------------------------------------------------
/src/main/resources/project/gradle/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/src/main/resources/project/gradle/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/src/main/resources/project/gradle3/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/src/main/resources/project/gradle3/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/src/main/resources/project/gradle4/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gejun123456/IntellijDubboPlugin/HEAD/src/main/resources/project/gradle4/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
6 |
--------------------------------------------------------------------------------
/src/main/resources/templates/boot-cli-capabilities.txt:
--------------------------------------------------------------------------------
1 | {{{logo}}}
2 | :: Service capabilities :: {{serviceUrl}}
3 |
4 | Supported dependencies
5 | {{{dependencies}}}
6 |
7 | Project types (* denotes the default)
8 | {{{types}}}
9 |
10 | Parameters
11 | {{{parameters}}}
12 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/main/resources/project/gradle/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
6 |
--------------------------------------------------------------------------------
/src/main/resources/project/gradle3/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.5.1-bin.zip
6 |
--------------------------------------------------------------------------------
/src/main/resources/project/gradle4/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Feb 06 12:27:20 CET 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
7 |
--------------------------------------------------------------------------------
/src/test/resources/application-test-custom-defaults.yml:
--------------------------------------------------------------------------------
1 | initializr:
2 | groupId:
3 | value: org.foo
4 | artifactId:
5 | value: foo-bar
6 | version:
7 | value: 1.2.4-SNAPSHOT
8 | name:
9 | value: FooBar
10 | description:
11 | value: FooBar Project
12 | packageName:
13 | value: org.foo.demo
--------------------------------------------------------------------------------
/src/main/resources/templates/Application.groovy:
--------------------------------------------------------------------------------
1 | package templates {{packageName}}
2 |
3 | import org.springframework.boot.SpringApplication
4 | {{applicationImports}}
5 |
6 | {{applicationAnnotations}}
7 | class {{applicationName}} {
8 |
9 | static void main(String[] args) {
10 | SpringApplication.run {{applicationName}}, args
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/spring-boot-2.0/DemoApplication.kt.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.springframework.boot.autoconfigure.SpringBootApplication
4 | import org.springframework.boot.runApplication
5 |
6 | @SpringBootApplication
7 | class DemoApplication {
8 | }
9 | fun main(args: Array) {
10 | runApplication(*args)
11 | }
--------------------------------------------------------------------------------
/src/test/resources/application-test-custom-env.yml:
--------------------------------------------------------------------------------
1 | initializr:
2 | env:
3 | artifactRepository: https://repo.spring.io/lib-release
4 | google-analytics-tracking-code: UA-1234567-89
5 | forceSsl: false
6 | fallbackApplicationName: FooBarApplication
7 | invalidApplicationNames:
8 | - InvalidApplication
9 | kotlin:
10 | default-version: 1.0.0-beta-2423
--------------------------------------------------------------------------------
/src/test/resources/project/groovy/standard/DemoApplication.groovy.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.springframework.boot.SpringApplication
4 | import org.springframework.boot.autoconfigure.SpringBootApplication
5 |
6 | @SpringBootApplication
7 | class DemoApplication {
8 |
9 | static void main(String[] args) {
10 | SpringApplication.run DemoApplication, args
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/standard/DemoApplication.kt.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.springframework.boot.SpringApplication
4 | import org.springframework.boot.autoconfigure.SpringBootApplication
5 |
6 | @SpringBootApplication
7 | class DemoApplication {
8 | }
9 |
10 | fun main(args: Array) {
11 | SpringApplication.run(DemoApplication::class.java, *args)
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/resources/templates/DemoServiceImpl.kt:
--------------------------------------------------------------------------------
1 | package {{dubboPackageName}};
2 |
3 | import java.util.Date;
4 |
5 | import com.alibaba.dubbo.config.annotation.Service;
6 |
7 | @Service(version = "{{dubboServiceVersion}}")
8 | class {{serviceSimpleName}}Impl : {{serviceSimpleName}} {
9 |
10 | override fun sayHello(name: String): String {
11 | return "Hello, " + name + ", " + Date()
12 | }
13 |
14 | }
--------------------------------------------------------------------------------
/src/test/resources/project/java/standard/DemoApplication.java.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class DemoApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(DemoApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/spring-boot-2.0/DemoApplicationLegacy.kt.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.springframework.boot.SpringApplication
4 | import org.springframework.boot.autoconfigure.SpringBootApplication
5 |
6 | @SpringBootApplication
7 | class DemoApplication {
8 | }
9 |
10 | fun main(args: Array) {
11 | SpringApplication.run(DemoApplication::class.java, *args)
12 | }
13 |
--------------------------------------------------------------------------------
/src/test/resources/project/maven/gitignore.gen:
--------------------------------------------------------------------------------
1 | /target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 | .sts4-cache
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | /nbproject/private/
21 | /build/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
--------------------------------------------------------------------------------
/src/main/resources/templates/ServletInitializer.kt:
--------------------------------------------------------------------------------
1 | package {{packageName}}
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder
4 | {{servletInitializrImport}}
5 |
6 | class ServletInitializer : SpringBootServletInitializer() {
7 |
8 | override fun configure(application: SpringApplicationBuilder) : SpringApplicationBuilder {
9 | return application.sources({{applicationName}}::class.java)
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/resources/templates/ServletInitializer.groovy:
--------------------------------------------------------------------------------
1 | package templates {{packageName}}
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder
4 | {{servletInitializrImport}}
5 |
6 | class ServletInitializer extends SpringBootServletInitializer {
7 |
8 | @Override
9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
10 | application.sources({{applicationName}})
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/test/resources/project/gradle/gitignore.gen:
--------------------------------------------------------------------------------
1 | .gradle
2 | /build/
3 | !gradle/wrapper/gradle-wrapper.jar
4 |
5 | ### STS ###
6 | .apt_generated
7 | .classpath
8 | .factorypath
9 | .project
10 | .settings
11 | .springBeans
12 | .sts4-cache
13 |
14 | ### IntelliJ IDEA ###
15 | .idea
16 | *.iws
17 | *.iml
18 | *.ipr
19 | /out/
20 |
21 | ### NetBeans ###
22 | /nbproject/private/
23 | /build/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
--------------------------------------------------------------------------------
/src/test/resources/project/groovy/spring-boot-1.4/DemoApplicationTests.groovy.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.junit.Test
4 | import org.junit.runner.RunWith
5 | import org.springframework.boot.test.context.SpringBootTest
6 | import org.springframework.test.context.junit4.SpringRunner
7 |
8 | @RunWith(SpringRunner)
9 | @SpringBootTest
10 | class DemoApplicationTests {
11 |
12 | @Test
13 | void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/resources/templates/ServletInitializer.java:
--------------------------------------------------------------------------------
1 | package {{packageName}};
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder;
4 | {{servletInitializrImport}}
5 |
6 | public class ServletInitializer extends SpringBootServletInitializer {
7 |
8 | @Override
9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
10 | return application.sources({{applicationName}}.class);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/spring-boot-1.4/DemoApplicationTests.kt.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.junit.Test
4 | import org.junit.runner.RunWith
5 | import org.springframework.boot.test.context.SpringBootTest
6 | import org.springframework.test.context.junit4.SpringRunner
7 |
8 | @RunWith(SpringRunner::class)
9 | @SpringBootTest
10 | class DemoApplicationTests {
11 |
12 | @Test
13 | fun contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/test/resources/project/java/spring-boot-1.4/DemoApplicationTests.java.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 | import org.springframework.test.context.junit4.SpringRunner;
7 |
8 | @RunWith(SpringRunner.class)
9 | @SpringBootTest
10 | public class DemoApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/resources/templates/schema.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE test_model(
2 | id INT (11) NOT NULL AUTO_INCREMENT COMMENT 'id',
3 | age INT (11) NOT NULL DEFAULT -1 COMMENT 'age',
4 | user_name VARCHAR (50) NOT NULL DEFAULT '' COMMENT 'userName',
5 | created_at DATETIME NOT NULL DEFAULT '1000-01-01 00:00:00' COMMENT 'createdAt',
6 | updated_at DATETIME NOT NULL DEFAULT '1000-01-01 00:00:00' COMMENT 'updatedAt',
7 | PRIMARY KEY (id)
8 | )ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'test_model';
--------------------------------------------------------------------------------
/src/test/resources/metadata/config/test-repository.json:
--------------------------------------------------------------------------------
1 | {
2 | "configuration": {
3 | "env": {
4 | "repositories": {
5 | "my-repo": {
6 | "name": "my repo",
7 | "url": "http://example.com/my",
8 | "snapshotsEnabled": true
9 | },
10 | "another-repo": {
11 | "name": "another repo",
12 | "url": "http://example.com/another",
13 | "snapshotsEnabled": false
14 | }
15 | }
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/test/resources/project/groovy/standard/ServletInitializer.groovy.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder
4 | import org.springframework.boot.context.web.SpringBootServletInitializer
5 |
6 | class ServletInitializer extends SpringBootServletInitializer {
7 |
8 | @Override
9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
10 | application.sources(DemoApplication)
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/standard/ServletInitializer.kt.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder
4 | import org.springframework.boot.context.web.SpringBootServletInitializer
5 |
6 | class ServletInitializer : SpringBootServletInitializer() {
7 |
8 | override fun configure(application: SpringApplicationBuilder) : SpringApplicationBuilder {
9 | return application.sources(DemoApplication::class.java)
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/src/test/resources/metadata/config/test-bom.json:
--------------------------------------------------------------------------------
1 | {
2 | "configuration": {
3 | "env": {
4 | "forceSsl": false,
5 | "boms": {
6 | "my-bom": {
7 | "groupId": "org.acme",
8 | "artifactId": "my-bom",
9 | "version": "1.2.3.RELEASE"
10 | },
11 | "another-bom": {
12 | "groupId": "org.acme",
13 | "artifactId": "another-bom",
14 | "version": "4.5.6.RELEASE"
15 | }
16 | }
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/test/resources/project/groovy/spring-boot-1.4/ServletInitializer.groovy.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder
4 | import org.springframework.boot.web.support.SpringBootServletInitializer
5 |
6 | class ServletInitializer extends SpringBootServletInitializer {
7 |
8 | @Override
9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
10 | application.sources(DemoApplication)
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/spring-boot-1.4/ServletInitializer.kt.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder
4 | import org.springframework.boot.web.support.SpringBootServletInitializer
5 |
6 | class ServletInitializer : SpringBootServletInitializer() {
7 |
8 | override fun configure(application: SpringApplicationBuilder) : SpringApplicationBuilder {
9 | return application.sources(DemoApplication::class.java)
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/src/test/resources/project/groovy/spring-boot-2.0/ServletInitializer.groovy.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder
4 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
5 |
6 | class ServletInitializer extends SpringBootServletInitializer {
7 |
8 | @Override
9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
10 | application.sources(DemoApplication)
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/spring-boot-2.0/ServletInitializer.kt.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder
4 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
5 |
6 | class ServletInitializer : SpringBootServletInitializer() {
7 |
8 | override fun configure(application: SpringApplicationBuilder) : SpringApplicationBuilder {
9 | return application.sources(DemoApplication::class.java)
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/src/test/resources/project/java/standard/ServletInitializer.java.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder;
4 | import org.springframework.boot.context.web.SpringBootServletInitializer;
5 |
6 | public class ServletInitializer extends SpringBootServletInitializer {
7 |
8 | @Override
9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
10 | return application.sources(DemoApplication.class);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/test/resources/project/groovy/standard/DemoApplicationTests.groovy.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.junit.Test
4 | import org.junit.runner.RunWith
5 | import org.springframework.boot.test.SpringApplicationConfiguration
6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
7 |
8 | @RunWith(SpringJUnit4ClassRunner)
9 | @SpringApplicationConfiguration(classes = DemoApplication)
10 | class DemoApplicationTests {
11 |
12 | @Test
13 | void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/test/resources/project/java/spring-boot-1.4/ServletInitializer.java.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder;
4 | import org.springframework.boot.web.support.SpringBootServletInitializer;
5 |
6 | public class ServletInitializer extends SpringBootServletInitializer {
7 |
8 | @Override
9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
10 | return application.sources(DemoApplication.class);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/test/resources/project/java/spring-boot-2.0/ServletInitializer.java.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder;
4 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
5 |
6 | public class ServletInitializer extends SpringBootServletInitializer {
7 |
8 | @Override
9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
10 | return application.sources(DemoApplication.class);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/standard/DemoApplicationTests.kt.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.junit.Test
4 | import org.junit.runner.RunWith
5 | import org.springframework.boot.test.SpringApplicationConfiguration
6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
7 |
8 | @RunWith(SpringJUnit4ClassRunner::class)
9 | @SpringApplicationConfiguration(classes = arrayOf(DemoApplication::class))
10 | class DemoApplicationTests {
11 |
12 | @Test
13 | fun contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/test/resources/project/java/standard/DemoApplicationTests.java.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.SpringApplicationConfiguration;
6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
7 |
8 | @RunWith(SpringJUnit4ClassRunner.class)
9 | @SpringApplicationConfiguration(classes = DemoApplication.class)
10 | public class DemoApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/resources/templates/httpie-examples.txt:
--------------------------------------------------------------------------------
1 | To create a default project:
2 | $ http {{serviceUrl}}/starter.zip -d
3 |
4 | To create a web project using Java 7:
5 | $ http {{serviceUrl}}/starter.zip dependencies==web \\
6 | javaVersion==1.7 -d
7 |
8 | To create a web/data-jpa gradle project unpacked:
9 | $ http {{serviceUrl}}/starter.tgz dependencies==web,data-jpa \\
10 | type==gradle-project baseDir==my-dir | tar -xzvf -
11 |
12 | To generate a Maven POM with war packaging:
13 | $ http {{serviceUrl}}/pom.xml packaging==war -o pom.xml
14 |
--------------------------------------------------------------------------------
/src/main/resources/templates/ApplicationTests.groovy:
--------------------------------------------------------------------------------
1 | package templates {{packageName}}
2 |
3 | import org.junit.Test
4 | import org.junit.runner.RunWith
5 | {{testImports}}
6 | {{#newTestInfrastructure}}
7 | @RunWith(SpringRunner)
8 | @SpringBootTest
9 | {{/newTestInfrastructure}}
10 | {{^newTestInfrastructure}}
11 | @RunWith(SpringJUnit4ClassRunner)
12 | @SpringApplicationConfiguration(classes = {{applicationName}})
13 | {{/newTestInfrastructure}}
14 | {{testAnnotations}}class {{applicationName}}Tests {
15 |
16 | @Test
17 | void contextLoads() {
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/resources/templates/DemoServiceImpl.java:
--------------------------------------------------------------------------------
1 | package {{dubboProviderPackageName}};
2 |
3 | import java.util.Date;
4 |
5 | import {{dubboPackageName}}.{{serviceSimpleName}};
6 |
7 | import com.alibaba.dubbo.config.annotation.Service;
8 |
9 | import org.springframework.stereotype.Component;
10 |
11 | @Service(version = "{{dubboServiceVersion}}")
12 | public class {{serviceSimpleName}}Impl implements {{serviceSimpleName}} {
13 |
14 | @Override
15 | public String sayHello(String name) {
16 | return "Hello, " + name + ", " + new Date();
17 | }
18 |
19 | }
--------------------------------------------------------------------------------
/src/main/resources/templates/curl-examples.txt:
--------------------------------------------------------------------------------
1 | To create a default demo.zip:
2 | $ curl {{serviceUrl}}/starter.zip -o demo.zip
3 |
4 | To create a web project using Java 7:
5 | $ curl {{serviceUrl}}/starter.zip -d dependencies=web \\
6 | -d javaVersion=1.7 -o demo.zip
7 |
8 | To create a web/data-jpa gradle project unpacked:
9 | $ curl {{serviceUrl}}/starter.tgz -d dependencies=web,data-jpa \\
10 | -d type=gradle-project -d baseDir=my-dir | tar -xzvf -
11 |
12 | To generate a Maven POM with war packaging:
13 | $ curl {{serviceUrl}}/pom.xml -d packaging=war -o pom.xml
14 |
--------------------------------------------------------------------------------
/src/main/resources/templates/ApplicationTests.kt:
--------------------------------------------------------------------------------
1 | package {{packageName}}
2 |
3 | import org.junit.Test
4 | import org.junit.runner.RunWith
5 | {{testImports}}
6 | {{#newTestInfrastructure}}
7 | @RunWith(SpringRunner::class)
8 | @SpringBootTest
9 | {{/newTestInfrastructure}}
10 | {{^newTestInfrastructure}}
11 | @RunWith(SpringJUnit4ClassRunner::class)
12 | @SpringApplicationConfiguration(classes = arrayOf({{applicationName}}::class))
13 | {{/newTestInfrastructure}}
14 | {{testAnnotations}}class {{applicationName}}Tests {
15 |
16 | @Test
17 | fun contextLoads() {
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/resources/templates/ApplicationTests.java:
--------------------------------------------------------------------------------
1 | package {{packageName}};
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | {{testImports}}
6 | {{#newTestInfrastructure}}
7 | @RunWith(SpringRunner.class)
8 | @SpringBootTest
9 | {{/newTestInfrastructure}}
10 | {{^newTestInfrastructure}}
11 | @RunWith(SpringJUnit4ClassRunner.class)
12 | @SpringApplicationConfiguration(classes = {{applicationName}}.class)
13 | {{/newTestInfrastructure}}
14 | {{testAnnotations}}public class {{applicationName}}Tests {
15 |
16 | @Test
17 | public void contextLoads() {
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/test/java/com/bruce/dubboplugin/TemplateRenderTest.java:
--------------------------------------------------------------------------------
1 | package com.bruce.dubboplugin;
2 |
3 | import com.bruce.dubboplugin.helper.TemplateRenderer;
4 | import com.google.common.collect.Maps;
5 | import org.junit.Test;
6 |
7 | import java.util.Map;
8 |
9 | public class TemplateRenderTest {
10 | @Test
11 | public void testTemplateRender(){
12 | Map model = Maps.newHashMap();
13 | model.put("groupId","com.lalala");
14 | String process = TemplateRenderer.INSTANCE.process("starter-pom.xml", model);
15 | System.out.println(process);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/test/resources/project/groovy/standard/DemoApplicationTestsWeb.groovy.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.junit.Test
4 | import org.junit.runner.RunWith
5 | import org.springframework.boot.test.SpringApplicationConfiguration
6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
7 | import org.springframework.test.context.web.WebAppConfiguration
8 |
9 | @RunWith(SpringJUnit4ClassRunner)
10 | @SpringApplicationConfiguration(classes = DemoApplication)
11 | @WebAppConfiguration
12 | class DemoApplicationTests {
13 |
14 | @Test
15 | void contextLoads() {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/resources/templates/gitignore.tmpl:
--------------------------------------------------------------------------------
1 | {{#mavenBuild}}
2 | /target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | {{/mavenBuild}}
5 | {{^mavenBuild}}
6 | .gradle
7 | /build/
8 | !gradle/wrapper/gradle-wrapper.jar
9 | {{/mavenBuild}}
10 |
11 | ### STS ###
12 | .apt_generated
13 | .classpath
14 | .factorypath
15 | .project
16 | .settings
17 | .springBeans
18 | .sts4-cache
19 |
20 | ### IntelliJ IDEA ###
21 | .idea
22 | *.iws
23 | *.iml
24 | *.ipr
25 | {{^mavenBuild}}
26 | /out/
27 | {{/mavenBuild}}
28 |
29 | ### NetBeans ###
30 | /nbproject/private/
31 | /build/
32 | /nbbuild/
33 | /dist/
34 | /nbdist/
35 | /.nb-gradle/
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/standard/DemoApplicationTestsWeb.kt.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo
2 |
3 | import org.junit.Test
4 | import org.junit.runner.RunWith
5 | import org.springframework.boot.test.SpringApplicationConfiguration
6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
7 | import org.springframework.test.context.web.WebAppConfiguration
8 |
9 | @RunWith(SpringJUnit4ClassRunner::class)
10 | @SpringApplicationConfiguration(classes = arrayOf(DemoApplication::class))
11 | @WebAppConfiguration
12 | class DemoApplicationTests {
13 |
14 | @Test
15 | fun contextLoads() {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/src/test/resources/project/java/standard/DemoApplicationTestsWeb.java.gen:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.SpringApplicationConfiguration;
6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
7 | import org.springframework.test.context.web.WebAppConfiguration;
8 |
9 | @RunWith(SpringJUnit4ClassRunner.class)
10 | @SpringApplicationConfiguration(classes = DemoApplication.class)
11 | @WebAppConfiguration
12 | public class DemoApplicationTests {
13 |
14 | @Test
15 | public void contextLoads() {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/resources/templates/TestModelMapper.java:
--------------------------------------------------------------------------------
1 | package {{MybatisMapperPackage}};
2 |
3 | import org.apache.ibatis.annotations.Mapper;
4 | import org.apache.ibatis.annotations.Param;
5 |
6 | import java.util.List;
7 | import {{MybatisModelQuatifiedName}};
8 |
9 | @Mapper
10 | public interface TestModelMapper {
11 | int insert(@Param("testModel") TestModel testModel);
12 |
13 | int insertSelective(@Param("testModel") TestModel testModel);
14 |
15 | int insertList(@Param("testModels") List testModels);
16 |
17 | int update(@Param("testModel") TestModel testModel);
18 |
19 | {{#dep_pagehelper}}
20 | List findByIdGreaterThan(@Param("minId")Integer minId);
21 | {{/dep_pagehelper}}
22 | }
--------------------------------------------------------------------------------
/mylicense/header.txt:
--------------------------------------------------------------------------------
1 | IntellijDubboPlugin
2 | Copyright (C) 2018 gejun123456@gmail.com
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
--------------------------------------------------------------------------------
/src/main/resources/templates/TestModelService.java:
--------------------------------------------------------------------------------
1 | package {{providerServicePackage}};
2 |
3 | import {{MybatisMapperQuatifiedName}};
4 | import {{MybatisModelQuatifiedName}};
5 | import com.github.pagehelper.Page;
6 | import com.github.pagehelper.PageHelper;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Service;
9 |
10 | @Service
11 | public class TestModelService {
12 |
13 |
14 | @Autowired
15 | private TestModelMapper testModelMapper;
16 |
17 | public Page findByIdGreaterThanWithPage(Integer minId, int page, int pageSize) {
18 | PageHelper.startPage(page, pageSize);
19 | return (Page) testModelMapper.findByIdGreaterThan(minId);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/resources/templates/Application.java:
--------------------------------------------------------------------------------
1 | package {{packageName}};
2 |
3 | import org.springframework.boot.SpringApplication;
4 |
5 | {{#isDubboClient}}
6 | import javax.annotation.PostConstruct;
7 | import com.alibaba.dubbo.config.annotation.Reference;
8 | import {{dubboServiceName}};
9 | {{/isDubboClient}}
10 | {{^hasWeb}}
11 | import java.util.concurrent.CountDownLatch;
12 | {{/hasWeb}}
13 |
14 |
15 | {{applicationImports}}
16 | {{applicationAnnotations}}
17 | public class {{applicationName}} {
18 |
19 | public static void main(String[] args) {{^hasWeb}}throws InterruptedException{{/hasWeb}}{
20 |
21 | SpringApplication.run({{applicationName}}.class, args);
22 |
23 | {{^hasWeb}}
24 | new CountDownLatch(1).await(); //hold住应用,防止provider退出
25 | {{/hasWeb}}
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/resources/project/java/standard/build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | springBootVersion = '1.2.3.RELEASE'
4 | }
5 | repositories {
6 | mavenCentral()
7 | }
8 | dependencies {
9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
10 | classpath('io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
11 | }
12 | }
13 |
14 | apply plugin: 'java'
15 | apply plugin: 'eclipse'
16 | apply plugin: 'spring-boot'
17 | apply plugin: 'io.spring.dependency-management'
18 |
19 | group = 'com.example'
20 | version = '0.0.1-SNAPSHOT'
21 | sourceCompatibility = 1.8
22 |
23 | repositories {
24 | mavenCentral()
25 | }
26 |
27 |
28 | dependencies {
29 | compile('org.springframework.boot:spring-boot-starter')
30 | testCompile('org.springframework.boot:spring-boot-starter-test')
31 | }
32 |
--------------------------------------------------------------------------------
/.idea/copyright/Apache2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/test/resources/project/groovy/standard/build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | springBootVersion = '1.2.3.RELEASE'
4 | }
5 | repositories {
6 | mavenCentral()
7 | }
8 | dependencies {
9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
10 | classpath('io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
11 | }
12 | }
13 |
14 | apply plugin: 'groovy'
15 | apply plugin: 'eclipse'
16 | apply plugin: 'spring-boot'
17 | apply plugin: 'io.spring.dependency-management'
18 |
19 | group = 'com.example'
20 | version = '0.0.1-SNAPSHOT'
21 | sourceCompatibility = 1.8
22 |
23 | repositories {
24 | mavenCentral()
25 | }
26 |
27 |
28 | dependencies {
29 | compile('org.springframework.boot:spring-boot-starter')
30 | compile('org.codehaus.groovy:groovy')
31 | testCompile('org.springframework.boot:spring-boot-starter-test')
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/resources/templates/cli-capabilities.txt:
--------------------------------------------------------------------------------
1 | {{{logo}}}
2 | :: Spring Initializr :: {{serviceUrl}}
3 |
4 | This service generates quickstart projects that can be easily customized.
5 | Possible customizations include a project's dependencies, Java version, and
6 | build system or build structure. See below for further details.
7 |
8 | The services uses a HAL based hypermedia format to expose a set of resources
9 | to interact with. If you access this root resource requesting application/json
10 | as media type the response will contain the following links:
11 | {{{types}}}
12 |
13 | The URI templates take a set of parameters to customize the result of a request
14 | to the linked resource.
15 | {{{parameters}}}
16 |
17 | The following section has a list of supported identifiers for the comma-separated
18 | list of "dependencies".
19 | {{{dependencies}}}
20 | {{#hasExamples}}
21 | Examples:
22 |
23 | {{{examples}}}
24 | {{/hasExamples}}
25 |
--------------------------------------------------------------------------------
/src/test/resources/project/gradle/version-override-build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | springBootVersion = '1.2.3.RELEASE'
4 | }
5 | repositories {
6 | mavenCentral()
7 | }
8 | dependencies {
9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
10 | classpath('io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
11 | }
12 | }
13 |
14 | apply plugin: 'java'
15 | apply plugin: 'eclipse'
16 | apply plugin: 'spring-boot'
17 | apply plugin: 'io.spring.dependency-management'
18 |
19 | group = 'com.example'
20 | version = '0.0.1-SNAPSHOT'
21 | sourceCompatibility = 1.8
22 |
23 | repositories {
24 | mavenCentral()
25 | }
26 |
27 |
28 | ext {
29 | springBarVersion = '0.2.0.RELEASE'
30 | springFooVersion = '0.1.0.RELEASE'
31 | }
32 |
33 | dependencies {
34 | compile('org.springframework.boot:spring-boot-starter-web')
35 | testCompile('org.springframework.boot:spring-boot-starter-test')
36 | }
37 |
--------------------------------------------------------------------------------
/src/test/resources/project/gradle/compile-only-dependency-build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | springBootVersion = '1.2.3.RELEASE'
4 | }
5 | repositories {
6 | mavenCentral()
7 | }
8 | dependencies {
9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
10 | classpath('io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
11 | }
12 | }
13 |
14 | apply plugin: 'java'
15 | apply plugin: 'eclipse'
16 | apply plugin: 'spring-boot'
17 | apply plugin: 'io.spring.dependency-management'
18 |
19 | group = 'com.example'
20 | version = '0.0.1-SNAPSHOT'
21 | sourceCompatibility = 1.8
22 |
23 | repositories {
24 | mavenCentral()
25 | }
26 |
27 |
28 | dependencies {
29 | compile('org.springframework.boot:spring-boot-starter-data-jpa')
30 | compile('org.springframework.boot:spring-boot-starter-web')
31 | compileOnly('org.acme:foo')
32 | testCompile('org.springframework.boot:spring-boot-starter-test')
33 | }
34 |
--------------------------------------------------------------------------------
/.idea/dataSources.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | mysql
6 | true
7 | com.mysql.jdbc.Driver
8 | jdbc:mysql://localhost:3306/world
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/test/resources/project/gradle/bom-property-build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | springBootVersion = '1.2.3.RELEASE'
4 | }
5 | repositories {
6 | mavenCentral()
7 | }
8 | dependencies {
9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
10 | classpath('io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
11 | }
12 | }
13 |
14 | apply plugin: 'java'
15 | apply plugin: 'eclipse'
16 | apply plugin: 'spring-boot'
17 | apply plugin: 'io.spring.dependency-management'
18 |
19 | group = 'com.example'
20 | version = '0.0.1-SNAPSHOT'
21 | sourceCompatibility = 1.8
22 |
23 | repositories {
24 | mavenCentral()
25 | }
26 |
27 |
28 | ext {
29 | fooVersion = '1.3.3'
30 | }
31 |
32 | dependencies {
33 | compile('org.acme:foo')
34 | testCompile('org.springframework.boot:spring-boot-starter-test')
35 | }
36 |
37 | dependencyManagement {
38 | imports {
39 | mavenBom "org.acme:foo-bom:${fooVersion}"
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/bruce/dubboplugin/dto/PreConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2017-2018 the original author or authors.
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package com.bruce.dubboplugin.dto;
20 |
21 | import lombok.Data;
22 |
23 | import java.util.List;
24 |
25 | @Data
26 | public class PreConfig {
27 | private List dependencies;
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/resources/project/gradle/bom-ordering-build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | springBootVersion = '1.2.3.RELEASE'
4 | }
5 | repositories {
6 | mavenCentral()
7 | }
8 | dependencies {
9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
10 | classpath('io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
11 | }
12 | }
13 |
14 | apply plugin: 'java'
15 | apply plugin: 'eclipse'
16 | apply plugin: 'spring-boot'
17 | apply plugin: 'io.spring.dependency-management'
18 |
19 | group = 'com.example'
20 | version = '0.0.1-SNAPSHOT'
21 | sourceCompatibility = 1.8
22 |
23 | repositories {
24 | mavenCentral()
25 | }
26 |
27 |
28 | dependencies {
29 | compile('org.acme:foo')
30 | testCompile('org.springframework.boot:spring-boot-starter-test')
31 | }
32 |
33 | dependencyManagement {
34 | imports {
35 | mavenBom "org.acme:bar-bom:1.0"
36 | mavenBom "org.acme:biz-bom:1.0"
37 | mavenBom "org.acme:foo-bom:1.0"
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/test/resources/project/java/war/build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | springBootVersion = '1.2.3.RELEASE'
4 | }
5 | repositories {
6 | mavenCentral()
7 | }
8 | dependencies {
9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
10 | classpath('io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
11 | }
12 | }
13 |
14 | apply plugin: 'java'
15 | apply plugin: 'eclipse-wtp'
16 | apply plugin: 'spring-boot'
17 | apply plugin: 'io.spring.dependency-management'
18 | apply plugin: 'war'
19 |
20 | group = 'com.example'
21 | version = '0.0.1-SNAPSHOT'
22 | sourceCompatibility = 1.8
23 |
24 | repositories {
25 | mavenCentral()
26 | }
27 |
28 | configurations {
29 | providedRuntime
30 | }
31 |
32 | dependencies {
33 | compile('org.springframework.boot:spring-boot-starter-web')
34 | providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
35 | testCompile('org.springframework.boot:spring-boot-starter-test')
36 | }
37 |
--------------------------------------------------------------------------------
/src/test/resources/project/groovy/war/build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | springBootVersion = '1.2.3.RELEASE'
4 | }
5 | repositories {
6 | mavenCentral()
7 | }
8 | dependencies {
9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
10 | classpath('io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
11 | }
12 | }
13 |
14 | apply plugin: 'groovy'
15 | apply plugin: 'eclipse-wtp'
16 | apply plugin: 'spring-boot'
17 | apply plugin: 'io.spring.dependency-management'
18 | apply plugin: 'war'
19 |
20 | group = 'com.example'
21 | version = '0.0.1-SNAPSHOT'
22 | sourceCompatibility = 1.8
23 |
24 | repositories {
25 | mavenCentral()
26 | }
27 |
28 | configurations {
29 | providedRuntime
30 | }
31 |
32 | dependencies {
33 | compile('org.springframework.boot:spring-boot-starter-web')
34 | compile('org.codehaus.groovy:groovy')
35 | providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
36 | testCompile('org.springframework.boot:spring-boot-starter-test')
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/bruce/dubboplugin/helper/IconUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2017-2018 the original author or authors.
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package com.bruce.dubboplugin.helper;
20 |
21 |
22 | import javax.swing.*;
23 |
24 | public class IconUtils {
25 | public static Icon dubbonIcon =new ImageIcon(IconUtils.class
26 | .getClassLoader().getResource("img/dubbo_icon.png"));
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/bruce/dubboplugin/dto/GenerateContentContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2017-2018 the original author or authors.
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package com.bruce.dubboplugin.dto;
20 |
21 | import com.intellij.openapi.project.Project;
22 | import com.intellij.openapi.vfs.VirtualFile;
23 | import lombok.Getter;
24 | import lombok.Setter;
25 |
26 | @Getter
27 | @Setter
28 | public class GenerateContentContext {
29 |
30 | private UserChooseDependency userChooseDependency;
31 |
32 | private String rootPath;
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/bruce/dubboplugin/helper/CommonUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2017-2018 the original author or authors.
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package com.bruce.dubboplugin.helper;
20 |
21 | import java.io.PrintWriter;
22 | import java.io.StringWriter;
23 |
24 | public class CommonUtils {
25 | public static String printStackTrace(Exception e) {
26 | StringWriter sw = new StringWriter();
27 | PrintWriter pw = new PrintWriter(sw);
28 | e.printStackTrace(pw);
29 | return sw.toString();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/.idea/modules/dubboPlugin_main.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
20 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/.idea/modules/dubboPlugin_test.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
20 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/main/resources/templates/parent-pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | {{groupId}}
7 | {{artifactId}}
8 | {{version}}
9 | pom
10 |
11 | {{name}}
12 | {{description}}
13 |
14 |
15 | {{#buildPropertiesMaven}}
16 | <{{key}}>{{#value}}{{.}}{{/value}}{{key}}>
17 | {{/buildPropertiesMaven}}
18 | {{#buildPropertiesVersions}}
19 | <{{key}}>{{#value}}{{.}}{{/value}}{{key}}>
20 | {{/buildPropertiesVersions}}
21 | 1.8
22 | 1.8
23 |
24 |
25 |
26 | {{apiArtifactId}}
27 | {{providerArtifactId}}
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/main/resources/templates/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## How to run
3 |
4 | ```bash
5 | ./mvnw spring-boot:run
6 | ```
7 |
8 |
9 | ## Links
10 |
11 | * [Dubbo](https://github.com/apache/incubator-dubbo)
12 | * [Dubbo Spring Boot](https://github.com/apache/incubator-dubbo-spring-boot-project) - Spring Boot Project for Dubbo.
13 | * [Developer Mailing list](https://github.com/apache/incubator-dubbo/issues/1393) - Any questions or suggestions? [Subscribe](https://github.com/apache/incubator-dubbo/issues/1393) to (dev@dubbo.incubator.apache.org) to discuss with us.
14 | * [Gitter channel](https://gitter.im/alibaba/dubbo) - Online chat room with Dubbo developers.
15 | * [Dubbo user manual(English)](http://dubbo.apache.org/books/dubbo-user-book-en/) or [Dubbo用户手册(中文)](http://dubbo.apache.org/books/dubbo-user-book/) - Describe how to use Dubbo and all features of Dubbo concretely.
16 | * [Dubbo developer guide(English)](http://dubbo.apache.org/books/dubbo-dev-book-en/) or [Dubbo开发手册(中文)](http://dubbo.apache.org/books/dubbo-dev-book/) - Detailly introduce the design principal, extension mechanisms, code conventions, version control and building project, etc.
17 | * [Dubbo admin manual(English)](http://dubbo.apache.org/books/dubbo-admin-book-en/) or [Dubbo管理手册(中文)](http://dubbo.apache.org/books/dubbo-admin-book/) - Describe how to use Dubbo registry and admin-console.
--------------------------------------------------------------------------------
/src/main/resources/templates/starter-pom-api.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | {{groupId}}
7 | {{apiArtifactId}}
8 | {{version}}
9 | {{packaging}}
10 |
11 | {{name}}
12 | {{description}}
13 |
14 |
15 | {{mavenParentGroupId}}
16 | {{mavenParentArtifactId}}
17 | {{mavenParentVersion}}
18 |
19 |
20 |
21 |
22 | {{#buildPropertiesMaven}}
23 | <{{key}}>{{#value}}{{.}}{{/value}}{{key}}>
24 | {{/buildPropertiesMaven}}
25 | {{#buildPropertiesVersions}}
26 | <{{key}}>{{#value}}{{.}}{{/value}}{{key}}> {{/buildPropertiesVersions}}
27 | 1.8
28 | 1.8
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/main/resources/templates/TestModel.java:
--------------------------------------------------------------------------------
1 | package {{mybatisModelPackage}};
2 |
3 | {{#dep_lombok}}
4 | import lombok.Data;
5 | {{/dep_lombok}}
6 | import java.util.Date;
7 |
8 | {{#dep_lombok}}
9 | @Data
10 | {{/dep_lombok}}
11 | public class TestModel {
12 | private Integer id;
13 |
14 | private Integer age;
15 |
16 | private String userName;
17 |
18 | private Date createdAt;
19 |
20 | private Date updatedAt;
21 |
22 | {{^dep_lombok}}
23 | public Integer getId() {
24 | return id;
25 | }
26 |
27 | public void setId(Integer id) {
28 | this.id = id;
29 | }
30 |
31 | public Integer getAge() {
32 | return age;
33 | }
34 |
35 | public void setAge(Integer age) {
36 | this.age = age;
37 | }
38 |
39 | public String getUserName() {
40 | return userName;
41 | }
42 |
43 | public void setUserName(String userName) {
44 | this.userName = userName;
45 | }
46 |
47 | public Date getCreatedAt() {
48 | return createdAt;
49 | }
50 |
51 | public void setCreatedAt(Date createdAt) {
52 | this.createdAt = createdAt;
53 | }
54 |
55 | public Date getUpdatedAt() {
56 | return updatedAt;
57 | }
58 |
59 | public void setUpdatedAt(Date updatedAt) {
60 | this.updatedAt = updatedAt;
61 | }
62 | {{/dep_lombok}}
63 | }
--------------------------------------------------------------------------------
/src/main/resources/META-INF/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 | com.bruce.intellijplugin.dubboPlugin
3 | Dubbo
4 | IntellijDubboPlugin
5 |
6 | 1.0
8 |
9 | - create dubbo+springboot project quickly
10 | - support mybatis
11 | - support pageHelper
12 | - support lombok
13 | - support spring retry
14 | - support hikari
15 |
16 |
17 | 中国朋友可以加qq群讨论:796916754
18 | ]]>
19 |
20 |
22 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/test/resources/project/gradle/kotlin-java6-build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | kotlinVersion = '1.1.1'
4 | springBootVersion = '1.2.3.RELEASE'
5 | }
6 | repositories {
7 | mavenCentral()
8 | }
9 | dependencies {
10 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
11 | classpath('io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
12 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
13 | classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
14 | }
15 | }
16 |
17 | apply plugin: 'kotlin'
18 | apply plugin: 'kotlin-spring'
19 | apply plugin: 'eclipse'
20 | apply plugin: 'spring-boot'
21 | apply plugin: 'io.spring.dependency-management'
22 |
23 | group = 'com.example'
24 | version = '0.0.1-SNAPSHOT'
25 | sourceCompatibility = 1.6
26 | compileKotlin {
27 | kotlinOptions {
28 | freeCompilerArgs = ["-Xjsr305=strict"]
29 | }
30 | }
31 | compileTestKotlin {
32 | kotlinOptions {
33 | freeCompilerArgs = ["-Xjsr305=strict"]
34 | }
35 | }
36 |
37 | repositories {
38 | mavenCentral()
39 | }
40 |
41 |
42 | dependencies {
43 | compile('org.springframework.boot:spring-boot-starter')
44 | compile("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
45 | compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
46 | testCompile('org.springframework.boot:spring-boot-starter-test')
47 | }
48 |
--------------------------------------------------------------------------------
/src/test/resources/project/gradle/kotlin-java7-build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | kotlinVersion = '1.1.1'
4 | springBootVersion = '1.2.3.RELEASE'
5 | }
6 | repositories {
7 | mavenCentral()
8 | }
9 | dependencies {
10 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
11 | classpath('io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
12 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
13 | classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
14 | }
15 | }
16 |
17 | apply plugin: 'kotlin'
18 | apply plugin: 'kotlin-spring'
19 | apply plugin: 'eclipse'
20 | apply plugin: 'spring-boot'
21 | apply plugin: 'io.spring.dependency-management'
22 |
23 | group = 'com.example'
24 | version = '0.0.1-SNAPSHOT'
25 | sourceCompatibility = 1.7
26 | compileKotlin {
27 | kotlinOptions {
28 | freeCompilerArgs = ["-Xjsr305=strict"]
29 | }
30 | }
31 | compileTestKotlin {
32 | kotlinOptions {
33 | freeCompilerArgs = ["-Xjsr305=strict"]
34 | }
35 | }
36 |
37 | repositories {
38 | mavenCentral()
39 | }
40 |
41 |
42 | dependencies {
43 | compile('org.springframework.boot:spring-boot-starter')
44 | compile("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlinVersion}")
45 | compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
46 | testCompile('org.springframework.boot:spring-boot-starter-test')
47 | }
48 |
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/standard/build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | kotlinVersion = '1.1.1'
4 | springBootVersion = '1.2.3.RELEASE'
5 | }
6 | repositories {
7 | mavenCentral()
8 | }
9 | dependencies {
10 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
11 | classpath('io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
12 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
13 | classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
14 | }
15 | }
16 |
17 | apply plugin: 'kotlin'
18 | apply plugin: 'kotlin-spring'
19 | apply plugin: 'eclipse'
20 | apply plugin: 'spring-boot'
21 | apply plugin: 'io.spring.dependency-management'
22 |
23 | group = 'com.example'
24 | version = '0.0.1-SNAPSHOT'
25 | sourceCompatibility = 1.8
26 | compileKotlin {
27 | kotlinOptions {
28 | freeCompilerArgs = ["-Xjsr305=strict"]
29 | jvmTarget = "1.8"
30 | }
31 | }
32 | compileTestKotlin {
33 | kotlinOptions {
34 | freeCompilerArgs = ["-Xjsr305=strict"]
35 | jvmTarget = "1.8"
36 | }
37 | }
38 |
39 | repositories {
40 | mavenCentral()
41 | }
42 |
43 |
44 | dependencies {
45 | compile('org.springframework.boot:spring-boot-starter')
46 | compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
47 | compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
48 | testCompile('org.springframework.boot:spring-boot-starter-test')
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/resources/templates/Application.kt:
--------------------------------------------------------------------------------
1 | package {{packageName}}
2 |
3 | {{^kotlinSupport}}
4 | import org.springframework.boot.SpringApplication
5 | {{/kotlinSupport}}
6 | {{applicationImports}}
7 | {{#kotlinSupport}}
8 | import org.springframework.boot.runApplication
9 | {{/kotlinSupport}}
10 |
11 | {{#isDubboClient}}
12 | import javax.annotation.PostConstruct;
13 | import com.alibaba.dubbo.config.annotation.Reference;
14 | import {{dubboServiceName}};
15 | {{/isDubboClient}}
16 |
17 | {{applicationAnnotations}}
18 | class {{applicationName}} {
19 | {{#isDubboClient}}
20 | @Reference(version = "{{dubboServiceVersion}}"{{^embeddedZookeeper}}, url = "dubbo://localhost:20880"{{/embeddedZookeeper}})
21 | var demoService: {{serviceSimpleName}}? = null;
22 | {{/isDubboClient}}
23 |
24 | {{#isDubboClient}}
25 | @PostConstruct
26 | fun init() {
27 | val sayHello = demoService!!.sayHello("world")
28 | System.err.println(sayHello)
29 | }
30 | {{/isDubboClient}}
31 | }
32 |
33 | fun main(args: Array) {
34 | {{^kotlinSupport}}
35 | {{#isDubboServer}}{{#embeddedZookeeper}}
36 | // start embedded zookeeper server
37 | EmbeddedZooKeeper(2181, false).start();
38 |
39 | {{/embeddedZookeeper}}{{/isDubboServer}}
40 | SpringApplication.run({{applicationName}}::class.java, *args)
41 | {{/kotlinSupport}}
42 | {{#kotlinSupport}}
43 | runApplication<{{applicationName}}>(*args)
44 | {{/kotlinSupport}}
45 | }
--------------------------------------------------------------------------------
/src/main/java/com/bruce/dubboplugin/dto/UserChooseDependency.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2017-2018 the original author or authors.
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package com.bruce.dubboplugin.dto;
20 |
21 | import lombok.Data;
22 |
23 | import java.util.List;
24 |
25 | @Data
26 | public class UserChooseDependency {
27 | private boolean useMaven;
28 |
29 | private boolean useGradle;
30 |
31 | private String bootVersion;
32 |
33 | private String groupId;
34 |
35 | private String artifactId;
36 |
37 | private boolean useJava;
38 |
39 | private boolean useKotlin;
40 |
41 | private List dependencyList;
42 |
43 | private boolean hasProvider;
44 |
45 | private String apiArtifactId;
46 |
47 | private String providerArtifactId;
48 |
49 | private boolean hasWebSupport;
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/resources/templates/application.properties:
--------------------------------------------------------------------------------
1 |
2 | {{#isDubboClient}}
3 | # Dubbo Config properties
4 | ## ApplicationConfig Bean
5 | dubbo.application.name= dubbo-demo-client
6 |
7 | ## RegistryConfig Bean
8 | dubbo.registry.id = my-registry
9 |
10 | {{#dep_zookeeper}}
11 | dubbo.registry.address = zookeeper://localhost:2181?client=curator
12 | {{/dep_zookeeper}}
13 |
14 | {{/isDubboClient}}
15 |
16 |
17 | {{#isDubboServer}}
18 | dubbo.application.name = dubbo-demo-server
19 |
20 | dubbo.scan.basePackages= {{dubboProviderPackageName}}
21 |
22 | ## RegistryConfig Bean
23 | dubbo.registry.id = my-registry
24 | dubbo.protocol.port=20880
25 | {{#dep_zookeeper}}
26 | dubbo.registry.address = zookeeper://localhost:2181?client=curator
27 | {{/dep_zookeeper}}
28 | {{/isDubboServer}}
29 |
30 |
31 | {{#dep_hikari}}
32 | spring.datasource.type=com.zaxxer.hikari.HikariDataSource
33 | spring.datasource.url=jdbc:mysql://localhost:3306/world
34 | spring.datasource.username=root
35 | spring.datasource.password=world
36 |
37 | # Hikari will use the above plus the following to setup connection pooling
38 | spring.datasource.hikari.minimumIdle=5
39 | spring.datasource.hikari.maximumPoolSize=60
40 | spring.datasource.hikari.idleTimeout=30000
41 | spring.datasource.hikari.poolName=SpringBootDubboHikariCP
42 | spring.datasource.hikari.maxLifetime=2000000
43 | spring.datasource.hikari.connectionTimeout=10000
44 | {{/dep_hikari}}
45 |
46 | {{#dep_mybatis}}
47 | mybatis.mapper-locations=classpath:/mapper/*.xml
48 | {{/dep_mybatis}}
--------------------------------------------------------------------------------
/src/test/resources/project/gradle/kotlin-java9-build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | kotlinVersion = '1.1.1'
4 | springBootVersion = '2.0.0.M6'
5 | }
6 | repositories {
7 | mavenCentral()
8 | maven { url "https://repo.spring.io/snapshot" }
9 | maven { url "https://repo.spring.io/milestone" }
10 | }
11 | dependencies {
12 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
13 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
14 | classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
15 | }
16 | }
17 |
18 | apply plugin: 'kotlin'
19 | apply plugin: 'kotlin-spring'
20 | apply plugin: 'eclipse'
21 | apply plugin: 'org.springframework.boot'
22 | apply plugin: 'io.spring.dependency-management'
23 |
24 | group = 'com.example'
25 | version = '0.0.1-SNAPSHOT'
26 | sourceCompatibility = 9
27 | compileKotlin {
28 | kotlinOptions {
29 | freeCompilerArgs = ["-Xjsr305=strict"]
30 | jvmTarget = "1.8"
31 | }
32 | }
33 | compileTestKotlin {
34 | kotlinOptions {
35 | freeCompilerArgs = ["-Xjsr305=strict"]
36 | jvmTarget = "1.8"
37 | }
38 | }
39 |
40 | repositories {
41 | mavenCentral()
42 | maven { url "https://repo.spring.io/snapshot" }
43 | maven { url "https://repo.spring.io/milestone" }
44 | }
45 |
46 |
47 | dependencies {
48 | compile('org.springframework.boot:spring-boot-starter')
49 | compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
50 | compile("org.jetbrains.kotlin:kotlin-reflect")
51 | testCompile('org.springframework.boot:spring-boot-starter-test')
52 | }
53 |
--------------------------------------------------------------------------------
/src/test/resources/project/gradle/kotlin-springboot2-build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | kotlinVersion = '1.1.1'
4 | springBootVersion = '2.0.0.M6'
5 | }
6 | repositories {
7 | mavenCentral()
8 | maven { url "https://repo.spring.io/snapshot" }
9 | maven { url "https://repo.spring.io/milestone" }
10 | }
11 | dependencies {
12 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
13 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
14 | classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
15 | }
16 | }
17 |
18 | apply plugin: 'kotlin'
19 | apply plugin: 'kotlin-spring'
20 | apply plugin: 'eclipse'
21 | apply plugin: 'org.springframework.boot'
22 | apply plugin: 'io.spring.dependency-management'
23 |
24 | group = 'com.example'
25 | version = '0.0.1-SNAPSHOT'
26 | sourceCompatibility = 1.8
27 | compileKotlin {
28 | kotlinOptions {
29 | freeCompilerArgs = ["-Xjsr305=strict"]
30 | jvmTarget = "1.8"
31 | }
32 | }
33 | compileTestKotlin {
34 | kotlinOptions {
35 | freeCompilerArgs = ["-Xjsr305=strict"]
36 | jvmTarget = "1.8"
37 | }
38 | }
39 |
40 | repositories {
41 | mavenCentral()
42 | maven { url "https://repo.spring.io/snapshot" }
43 | maven { url "https://repo.spring.io/milestone" }
44 | }
45 |
46 |
47 | dependencies {
48 | compile('org.springframework.boot:spring-boot-starter')
49 | compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
50 | compile("org.jetbrains.kotlin:kotlin-reflect")
51 | testCompile('org.springframework.boot:spring-boot-starter-test')
52 | }
53 |
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/war/build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | kotlinVersion = '1.1.1'
4 | springBootVersion = '1.2.3.RELEASE'
5 | }
6 | repositories {
7 | mavenCentral()
8 | }
9 | dependencies {
10 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
11 | classpath('io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
12 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
13 | classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
14 | }
15 | }
16 |
17 | apply plugin: 'kotlin'
18 | apply plugin: 'kotlin-spring'
19 | apply plugin: 'eclipse-wtp'
20 | apply plugin: 'spring-boot'
21 | apply plugin: 'io.spring.dependency-management'
22 | apply plugin: 'war'
23 |
24 | group = 'com.example'
25 | version = '0.0.1-SNAPSHOT'
26 | sourceCompatibility = 1.8
27 | compileKotlin {
28 | kotlinOptions {
29 | freeCompilerArgs = ["-Xjsr305=strict"]
30 | jvmTarget = "1.8"
31 | }
32 | }
33 | compileTestKotlin {
34 | kotlinOptions {
35 | freeCompilerArgs = ["-Xjsr305=strict"]
36 | jvmTarget = "1.8"
37 | }
38 | }
39 |
40 | repositories {
41 | mavenCentral()
42 | }
43 |
44 | configurations {
45 | providedRuntime
46 | }
47 |
48 | dependencies {
49 | compile('org.springframework.boot:spring-boot-starter-web')
50 | compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
51 | compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
52 | providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
53 | testCompile('org.springframework.boot:spring-boot-starter-test')
54 | }
55 |
--------------------------------------------------------------------------------
/src/test/resources/project/gradle/kotlin-springboot2-legacy-build.gradle.gen:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | kotlinVersion = '1.1.1'
4 | springBootVersion = '2.0.0.M5'
5 | }
6 | repositories {
7 | mavenCentral()
8 | maven { url "https://repo.spring.io/snapshot" }
9 | maven { url "https://repo.spring.io/milestone" }
10 | }
11 | dependencies {
12 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
13 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
14 | classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
15 | }
16 | }
17 |
18 | apply plugin: 'kotlin'
19 | apply plugin: 'kotlin-spring'
20 | apply plugin: 'eclipse'
21 | apply plugin: 'org.springframework.boot'
22 | apply plugin: 'io.spring.dependency-management'
23 |
24 | group = 'com.example'
25 | version = '0.0.1-SNAPSHOT'
26 | sourceCompatibility = 1.8
27 | compileKotlin {
28 | kotlinOptions {
29 | freeCompilerArgs = ["-Xjsr305=strict"]
30 | jvmTarget = "1.8"
31 | }
32 | }
33 | compileTestKotlin {
34 | kotlinOptions {
35 | freeCompilerArgs = ["-Xjsr305=strict"]
36 | jvmTarget = "1.8"
37 | }
38 | }
39 |
40 | repositories {
41 | mavenCentral()
42 | maven { url "https://repo.spring.io/snapshot" }
43 | maven { url "https://repo.spring.io/milestone" }
44 | }
45 |
46 |
47 | dependencies {
48 | compile('org.springframework.boot:spring-boot-starter')
49 | compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
50 | compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
51 | testCompile('org.springframework.boot:spring-boot-starter-test')
52 | }
53 |
--------------------------------------------------------------------------------
/src/test/resources/project/java/standard/pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.2.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter
31 |
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-starter-test
36 | test
37 |
38 |
39 |
40 |
41 |
42 |
43 | org.springframework.boot
44 | spring-boot-maven-plugin
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/main/java/com/bruce/dubboplugin/dto/DependencyConstant.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2017-2018 the original author or authors.
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package com.bruce.dubboplugin.dto;
20 |
21 | public class DependencyConstant {
22 | public static final String MYBAITS = "mybatis";
23 |
24 | public static final String MYSQL = "mysql";
25 |
26 | public static final String LOMBOK = "lombok";
27 |
28 | public static final String REDIS = "redis";
29 |
30 | public static final String FASTJSON = "fastjson";
31 |
32 | public static final String RABBIT_MQ = "rabbitmq";
33 |
34 | public static final String COMMON_LANGS_3 = "commonlang3";
35 |
36 | public static final String SPRING_RETRY = "springretry";
37 |
38 | public static final String ZOOKEEPER = "zookeeper";
39 | public static final String DUBBO = "dubbo";
40 |
41 | public static final String WEB_TOMCAT = "webtomcat";
42 | public static final String PAGE_HELPER = "pagehelper";
43 |
44 | public static final String HIKARI = "hikari";
45 | }
46 |
--------------------------------------------------------------------------------
/src/test/resources/project/maven/version-override-pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.2.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 | 0.2.0.RELEASE
26 | 0.1.0.RELEASE
27 |
28 |
29 |
30 |
31 | org.springframework.boot
32 | spring-boot-starter-web
33 |
34 |
35 |
36 | org.springframework.boot
37 | spring-boot-starter-test
38 | test
39 |
40 |
41 |
42 |
43 |
44 |
45 | org.springframework.boot
46 | spring-boot-maven-plugin
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/src/test/resources/project/java/war/pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | war
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.2.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-web
31 |
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-starter-tomcat
36 | provided
37 |
38 |
39 | org.springframework.boot
40 | spring-boot-starter-test
41 | test
42 |
43 |
44 |
45 |
46 |
47 |
48 | org.springframework.boot
49 | spring-boot-maven-plugin
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/src/test/resources/project/maven/compile-only-dependency-pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.2.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-data-jpa
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-web
35 |
36 |
37 |
38 | org.acme
39 | foo
40 | true
41 |
42 |
43 | org.springframework.boot
44 | spring-boot-starter-test
45 | test
46 |
47 |
48 |
49 |
50 |
51 |
52 | org.springframework.boot
53 | spring-boot-maven-plugin
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/src/test/resources/project/maven/bom-property-pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.2.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.3.3
25 | 1.8
26 |
27 |
28 |
29 |
30 | org.acme
31 | foo
32 |
33 |
34 |
35 | org.springframework.boot
36 | spring-boot-starter-test
37 | test
38 |
39 |
40 |
41 |
42 |
43 |
44 | org.acme
45 | foo-bom
46 | ${foo.version}
47 | pom
48 | import
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-maven-plugin
58 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/src/main/java/com/bruce/dubboplugin/form/ChooseDubboConfigurationStep.form:
--------------------------------------------------------------------------------
1 |
2 |
38 |
--------------------------------------------------------------------------------
/src/main/resources/templates/MapperTest.java:
--------------------------------------------------------------------------------
1 | package {{packageName}};
2 |
3 | import {{MybatisModelQuatifiedName}};
4 | import {{MybatisMapperQuatifiedName}};
5 | {{#dep_pagehelper}}
6 | import {{MybatisServiceQuatifiedName}};
7 | {{/dep_pagehelper}}
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.boot.test.context.SpringBootTest;
12 | import org.springframework.test.context.junit4.SpringRunner;
13 |
14 | {{#dep_pagehelper}}
15 | import com.github.pagehelper.Page;
16 | import org.assertj.core.api.Assertions;
17 | {{/dep_pagehelper}}
18 |
19 | import java.util.Date;
20 |
21 | @RunWith(SpringRunner.class)
22 | @SpringBootTest
23 | public class MapperTest {
24 |
25 | @Autowired
26 | private TestModelMapper testModelMapper;
27 |
28 | {{#dep_pagehelper}}
29 | @Autowired
30 | private TestModelService testModelService;
31 | {{/dep_pagehelper}}
32 | @Test
33 | public void testMapper(){
34 | TestModel testModel = new TestModel();
35 | testModel.setAge(1);
36 | testModel.setCreatedAt(new Date());
37 | testModel.setUpdatedAt(new Date());
38 | testModel.setUserName("lalal");
39 | testModelMapper.insert(testModel);
40 | }
41 |
42 | {{#dep_pagehelper}}
43 | @Test
44 | public void testMapperWithPage(){
45 | for (int i = 0; i < 100; i++) {
46 | TestModel testModel = new TestModel();
47 | testModel.setAge(1);
48 | testModel.setCreatedAt(new Date());
49 | testModel.setUpdatedAt(new Date());
50 | testModel.setUserName("lalal");
51 | testModelMapper.insert(testModel);
52 | }
53 |
54 | Page byIdGreaterThanWithPage = testModelService.findByIdGreaterThanWithPage(0, 1, 20);
55 | Assertions.assertThat(byIdGreaterThanWithPage.getPageSize()).isGreaterThanOrEqualTo(5);
56 | Assertions.assertThat(byIdGreaterThanWithPage.size()).isEqualTo(20);
57 | }
58 | {{/dep_pagehelper}}
59 | }
--------------------------------------------------------------------------------
/src/main/resources/templates/.gitignore.txt:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Java template
3 | # Compiled class file
4 | *.class
5 |
6 | # Log file
7 | *.log
8 |
9 | # BlueJ files
10 | *.ctxt
11 |
12 | # Mobile Tools for Java (J2ME)
13 | .mtj.tmp/
14 |
15 | # Package Files #
16 | *.jar
17 | *.war
18 | *.nar
19 | *.ear
20 | *.zip
21 | *.tar.gz
22 | *.rar
23 |
24 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
25 | hs_err_pid*
26 | ### JetBrains template
27 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
28 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
29 |
30 | # User-specific stuff
31 | .idea/**/workspace.xml
32 | .idea/**/tasks.xml
33 | .idea/**/dictionaries
34 | .idea/**/shelf
35 |
36 | # Sensitive or high-churn files
37 | .idea/**/dataSources/
38 | .idea/**/dataSources.ids
39 | .idea/**/dataSources.local.xml
40 | .idea/**/sqlDataSources.xml
41 | .idea/**/dynamic.xml
42 | .idea/**/uiDesigner.xml
43 | .idea/**/dbnavigator.xml
44 |
45 | # Gradle
46 | .idea/**/gradle.xml
47 | .idea/**/libraries
48 |
49 | # CMake
50 | cmake-build-debug/
51 | cmake-build-release/
52 |
53 | # Mongo Explorer plugin
54 | .idea/**/mongoSettings.xml
55 |
56 | # File-based project format
57 | *.iws
58 |
59 | # IntelliJ
60 | out/
61 |
62 | # mpeltonen/sbt-idea plugin
63 | .idea_modules/
64 |
65 | # JIRA plugin
66 | atlassian-ide-plugin.xml
67 |
68 | # Cursive Clojure plugin
69 | .idea/replstate.xml
70 |
71 | # Crashlytics plugin (for Android Studio and IntelliJ)
72 | com_crashlytics_export_strings.xml
73 | crashlytics.properties
74 | crashlytics-build.properties
75 | fabric.properties
76 |
77 | # Editor-based Rest Client
78 | .idea/httpRequests
79 | ### Maven template
80 | target/
81 | pom.xml.tag
82 | pom.xml.releaseBackup
83 | pom.xml.versionsBackup
84 | pom.xml.next
85 | release.properties
86 | dependency-reduced-pom.xml
87 | buildNumber.properties
88 | .mvn/timing.properties
89 |
90 | # Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
91 | !/.mvn/wrapper/maven-wrapper.jar
92 |
93 |
--------------------------------------------------------------------------------
/src/main/java/com/bruce/dubboplugin/dto/Dependency.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2017-2018 the original author or authors.
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package com.bruce.dubboplugin.dto;
20 |
21 | import lombok.Builder;
22 | import lombok.Data;
23 |
24 | import java.util.Arrays;
25 | import java.util.Collections;
26 | import java.util.List;
27 |
28 | @Data
29 | @Builder
30 | public class Dependency {
31 |
32 | /**
33 | * Compile Scope.
34 | */
35 | public static final String SCOPE_COMPILE = "compile";
36 |
37 | /**
38 | * Compile Only Scope.
39 | */
40 | public static final String SCOPE_COMPILE_ONLY = "compileOnly";
41 |
42 | /**
43 | * Runtime Scope.
44 | */
45 | public static final String SCOPE_RUNTIME = "runtime";
46 |
47 | /**
48 | * Provided Scope.
49 | */
50 | public static final String SCOPE_PROVIDED = "provided";
51 |
52 | /**
53 | * Test Scope.
54 | */
55 | public static final String SCOPE_TEST = "test";
56 |
57 | /**
58 | * All scope types.
59 | */
60 | public static final List SCOPE_ALL = Collections
61 | .unmodifiableList(Arrays.asList(SCOPE_COMPILE, SCOPE_RUNTIME,
62 | SCOPE_COMPILE_ONLY, SCOPE_PROVIDED, SCOPE_TEST));
63 |
64 | private String groupId;
65 |
66 | private String artifactId;
67 |
68 | private String version;
69 |
70 | @Builder.Default
71 | private String scope = SCOPE_COMPILE;
72 |
73 | private String type;
74 | }
75 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Gradle template
3 | .gradle
4 | /build/
5 |
6 | # Ignore Gradle GUI config
7 | gradle-app.setting
8 |
9 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
10 | !gradle-wrapper.jar
11 |
12 | # Cache of project
13 | .gradletasknamecache
14 |
15 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
16 | # gradle/wrapper/gradle-wrapper.properties
17 | ### Kotlin template
18 | # Compiled class file
19 | *.class
20 |
21 | # Log file
22 | *.log
23 |
24 | # BlueJ files
25 | *.ctxt
26 |
27 | # Mobile Tools for Java (J2ME)
28 | .mtj.tmp/
29 |
30 | # Package Files #
31 | #*.jar
32 | *.war
33 | *.nar
34 | *.ear
35 | *.zip
36 | *.tar.gz
37 | *.rar
38 |
39 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
40 | hs_err_pid*
41 | ### Java template
42 | # Compiled class file
43 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
44 | ### JetBrains template
45 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
46 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
47 |
48 | # User-specific stuff
49 | .idea/**/workspace.xml
50 | .idea/**/tasks.xml
51 | .idea/**/dictionaries
52 | .idea/**/shelf
53 |
54 | # Sensitive or high-churn files
55 | .idea/**/dataSources/
56 | .idea/**/dataSources.ids
57 | .idea/**/dataSources.local.xml
58 | .idea/**/sqlDataSources.xml
59 | .idea/**/dynamic.xml
60 | .idea/**/uiDesigner.xml
61 | .idea/**/dbnavigator.xml
62 |
63 | # Gradle
64 | .idea/**/gradle.xml
65 | .idea/**/libraries
66 |
67 | # CMake
68 | cmake-build-debug/
69 | cmake-build-release/
70 |
71 | # Mongo Explorer plugin
72 | .idea/**/mongoSettings.xml
73 |
74 | # File-based project format
75 | *.iws
76 |
77 | # IntelliJ
78 | out/
79 |
80 | # mpeltonen/sbt-idea plugin
81 | .idea_modules/
82 |
83 | # JIRA plugin
84 | atlassian-ide-plugin.xml
85 |
86 | # Cursive Clojure plugin
87 | .idea/replstate.xml
88 |
89 | # Crashlytics plugin (for Android Studio and IntelliJ)
90 | com_crashlytics_export_strings.xml
91 | crashlytics.properties
92 | crashlytics-build.properties
93 | fabric.properties
94 |
95 | # Editor-based Rest Client
96 | .idea/httpRequests
97 |
98 | /src/test/resources/testFiles/
99 |
--------------------------------------------------------------------------------
/src/test/resources/project/maven/bom-ordering-pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.2.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.acme
30 | foo
31 |
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-starter-test
36 | test
37 |
38 |
39 |
40 |
41 |
42 |
43 | org.acme
44 | foo-bom
45 | 1.0
46 | pom
47 | import
48 |
49 |
50 | org.acme
51 | biz-bom
52 | 1.0
53 | pom
54 | import
55 |
56 |
57 | org.acme
58 | bar-bom
59 | 1.0
60 | pom
61 | import
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | org.springframework.boot
70 | spring-boot-maven-plugin
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/src/test/resources/project/groovy/standard/pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.2.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter
31 |
32 |
33 | org.codehaus.groovy
34 | groovy
35 |
36 |
37 |
38 | org.springframework.boot
39 | spring-boot-starter-test
40 | test
41 |
42 |
43 |
44 |
45 |
46 |
47 | org.springframework.boot
48 | spring-boot-maven-plugin
49 |
50 |
51 | org.codehaus.gmavenplus
52 | gmavenplus-plugin
53 | 1.5
54 |
55 |
56 |
57 | addSources
58 | addTestSources
59 | generateStubs
60 | compile
61 | testGenerateStubs
62 | testCompile
63 | removeStubs
64 | removeTestStubs
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/src/test/resources/project/groovy/war/pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | war
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.2.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-web
31 |
32 |
33 | org.codehaus.groovy
34 | groovy
35 |
36 |
37 |
38 | org.springframework.boot
39 | spring-boot-starter-tomcat
40 | provided
41 |
42 |
43 | org.springframework.boot
44 | spring-boot-starter-test
45 | test
46 |
47 |
48 |
49 |
50 |
51 |
52 | org.springframework.boot
53 | spring-boot-maven-plugin
54 |
55 |
56 | org.codehaus.gmavenplus
57 | gmavenplus-plugin
58 | 1.5
59 |
60 |
61 |
62 | addSources
63 | addTestSources
64 | generateStubs
65 | compile
66 | testGenerateStubs
67 | testCompile
68 | removeStubs
69 | removeTestStubs
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/src/main/resources/project/gradle3/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/src/main/resources/project/gradle4/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/src/main/resources/project/gradle/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/src/test/resources/metadata/sagan/spring-boot.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "spring-boot",
3 | "name": "Spring Boot",
4 | "repoUrl": "https://github.com/spring-projects/spring-boot",
5 | "siteUrl": "http://projects.spring.io/spring-boot",
6 | "category": "active",
7 | "stackOverflowTags": "spring-boot",
8 | "projectReleases": [
9 | {
10 | "releaseStatus": "SNAPSHOT",
11 | "refDocUrl": "http://docs.spring.io/spring-boot/docs/1.4.1.BUILD-SNAPSHOT/reference/htmlsingle/",
12 | "apiDocUrl": "http://docs.spring.io/spring-boot/docs/1.4.1.BUILD-SNAPSHOT/api/",
13 | "groupId": "org.springframework.boot",
14 | "artifactId": "spring-boot",
15 | "repository": {
16 | "id": "spring-snapshots",
17 | "name": "Spring Snapshots",
18 | "url": "https://repo.spring.io/libs-snapshot",
19 | "snapshotsEnabled": true
20 | },
21 | "preRelease": false,
22 | "generalAvailability": false,
23 | "versionDisplayName": "1.4.1",
24 | "current": false,
25 | "snapshot": true,
26 | "version": "1.4.1.BUILD-SNAPSHOT"
27 | },
28 | {
29 | "releaseStatus": "GENERAL_AVAILABILITY",
30 | "refDocUrl": "http://docs.spring.io/spring-boot/docs/1.4.0.RELEASE/reference/htmlsingle/",
31 | "apiDocUrl": "http://docs.spring.io/spring-boot/docs/1.4.0.RELEASE/api/",
32 | "groupId": "org.springframework.boot",
33 | "artifactId": "spring-boot",
34 | "repository": null,
35 | "preRelease": false,
36 | "generalAvailability": true,
37 | "versionDisplayName": "1.4.0",
38 | "current": true,
39 | "snapshot": false,
40 | "version": "1.4.0.RELEASE"
41 | },
42 | {
43 | "releaseStatus": "SNAPSHOT",
44 | "refDocUrl": "http://docs.spring.io/spring-boot/docs/1.3.8.BUILD-SNAPSHOT/reference/htmlsingle/",
45 | "apiDocUrl": "http://docs.spring.io/spring-boot/docs/1.3.8.BUILD-SNAPSHOT/api/",
46 | "groupId": "org.springframework.boot",
47 | "artifactId": "spring-boot",
48 | "repository": {
49 | "id": "spring-snapshots",
50 | "name": "Spring Snapshots",
51 | "url": "https://repo.spring.io/libs-snapshot",
52 | "snapshotsEnabled": true
53 | },
54 | "preRelease": false,
55 | "generalAvailability": false,
56 | "versionDisplayName": "1.3.8",
57 | "current": false,
58 | "snapshot": true,
59 | "version": "1.3.8.BUILD-SNAPSHOT"
60 | },
61 | {
62 | "releaseStatus": "GENERAL_AVAILABILITY",
63 | "refDocUrl": "http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/",
64 | "apiDocUrl": "http://docs.spring.io/spring-boot/docs/current/api/",
65 | "groupId": "org.springframework.boot",
66 | "artifactId": "spring-boot",
67 | "repository": null,
68 | "preRelease": false,
69 | "generalAvailability": true,
70 | "versionDisplayName": "1.3.7",
71 | "current": false,
72 | "snapshot": false,
73 | "version": "1.3.7.RELEASE"
74 | }
75 | ],
76 | "aggregator": false,
77 | "stackOverflowTagList": [
78 | "spring-boot"
79 | ]
80 | }
--------------------------------------------------------------------------------
/src/test/resources/metadata/sagan/spring-boot-no-default.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "spring-boot",
3 | "name": "Spring Boot",
4 | "repoUrl": "https://github.com/spring-projects/spring-boot",
5 | "siteUrl": "http://projects.spring.io/spring-boot",
6 | "category": "active",
7 | "stackOverflowTags": "spring-boot",
8 | "projectReleases": [
9 | {
10 | "releaseStatus": "SNAPSHOT",
11 | "refDocUrl": "http://docs.spring.io/spring-boot/docs/1.3.1.BUILD-SNAPSHOT/reference/htmlsingle/",
12 | "apiDocUrl": "http://docs.spring.io/spring-boot/docs/1.3.1.BUILD-SNAPSHOT/api/",
13 | "groupId": "org.springframework.boot",
14 | "artifactId": "spring-boot",
15 | "repository": {
16 | "id": "spring-snapshots",
17 | "name": "Spring Snapshots",
18 | "url": "https://repo.spring.io/libs-snapshot",
19 | "snapshotsEnabled": true
20 | },
21 | "preRelease": false,
22 | "generalAvailability": false,
23 | "versionDisplayName": "1.3.1",
24 | "current": false,
25 | "snapshot": true,
26 | "version": "1.3.1.BUILD-SNAPSHOT"
27 | },
28 | {
29 | "releaseStatus": "GENERAL_AVAILABILITY",
30 | "refDocUrl": "http://docs.spring.io/spring-boot/docs/1.3.0.RELEASE/reference/htmlsingle/",
31 | "apiDocUrl": "http://docs.spring.io/spring-boot/docs/1.3.0.RELEASE/api/",
32 | "groupId": "org.springframework.boot",
33 | "artifactId": "spring-boot",
34 | "repository": null,
35 | "preRelease": false,
36 | "generalAvailability": true,
37 | "versionDisplayName": "1.3.0",
38 | "current": false,
39 | "snapshot": false,
40 | "version": "1.3.0.RELEASE"
41 | },
42 | {
43 | "releaseStatus": "SNAPSHOT",
44 | "refDocUrl": "http://docs.spring.io/spring-boot/docs/1.2.6.BUILD-SNAPSHOT/reference/htmlsingle/",
45 | "apiDocUrl": "http://docs.spring.io/spring-boot/docs/1.2.6.BUILD-SNAPSHOT/api/",
46 | "groupId": "org.springframework.boot",
47 | "artifactId": "spring-boot",
48 | "repository": {
49 | "id": "spring-snapshots",
50 | "name": "Spring Snapshots",
51 | "url": "https://repo.spring.io/libs-snapshot",
52 | "snapshotsEnabled": true
53 | },
54 | "preRelease": false,
55 | "generalAvailability": false,
56 | "versionDisplayName": "1.2.6",
57 | "current": false,
58 | "snapshot": true,
59 | "version": "1.2.6.BUILD-SNAPSHOT"
60 | },
61 | {
62 | "releaseStatus": "GENERAL_AVAILABILITY",
63 | "refDocUrl": "http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/",
64 | "apiDocUrl": "http://docs.spring.io/spring-boot/docs/current/api/",
65 | "groupId": "org.springframework.boot",
66 | "artifactId": "spring-boot",
67 | "repository": null,
68 | "preRelease": false,
69 | "generalAvailability": true,
70 | "versionDisplayName": "1.2.5",
71 | "current": false,
72 | "snapshot": false,
73 | "version": "1.2.5.RELEASE"
74 | }
75 | ],
76 | "aggregator": false,
77 | "stackOverflowTagList": [
78 | "spring-boot"
79 | ]
80 | }
--------------------------------------------------------------------------------
/README_CN.md:
--------------------------------------------------------------------------------
1 | # IntellijDubboPlugin
2 |
3 | 该项目已迁移至 https://github.com/dubbo/intellij-idea-plugin
4 |
5 | [](https://opensource.org/licenses/Apache-2.0)
6 | [][plugin]
7 | [][plugin]
8 |
9 |
10 | ## 功能
11 |
12 | - 快速构建一个dubbo+springboot的项目 包含ApiModule 和 providerModule
13 | - 可选其他依赖 如mybatis pageHelper hikari 并且配置好 生成代码例子和testcase 可立即运行
14 |
15 |
16 | ## 目前支持的依赖
17 | | 依赖名 | 开始支持的版本 |
18 | |----------------------|------------------- |
19 | | MYBAITS | v1.0 |
20 | | MYSQL | v1.0 |
21 | |LOMBOK | v1.0 |
22 | | REDIS | v1.0 |
23 | | FASTJSON | v1.0 |
24 | | RABBIT_MQ | v1.0 |
25 | | COMMON_LANGS_3 | v1.0 |
26 | | SPRING_RETRY | v1.0 |
27 | | ZOOKEEPER | v1.0 |
28 | |WEB_TOMCAT| v1.0 |
29 | |PAGE_HELPER | v1.0 |
30 | |HIKARI | v1.0 |
31 |
32 |
33 | ## 截图
34 |
35 | - 第一步操作
36 | 
37 |
38 | - 第二步操作
39 | 
40 |
41 |
42 | - 第三步操作
43 | 
44 |
45 | - 生成项目结构
46 | 
47 |
48 | - 生成的主类
49 | 
50 |
51 | - 生成的dubboProvider类
52 | 
53 |
54 |
55 | - 生成的mybatis接口例子
56 | 
57 |
58 |
59 | - 生成的service例子 此处使用了pageHelper
60 | 
61 |
62 |
63 | - 生成的testcase
64 | 
65 |
66 |
67 |
68 | ## 安装
69 |
70 | 插件支持Intellij 2018.1版本及以上版本
71 |
72 | **使用 IDE 内置插件系统:**
73 | - Preferences(Settings) > Plugins > Browse repositories... > 搜索并找到"Dubbo" > Install Plugin
74 |
75 |
76 | **直接下载**
77 | - download[`lastest plugin zip`](http://ogyxv3y5w.bkt.clouddn.com/dubboPlugin-1.0.zip) -> Preferences(Settings) > Plugins > Install plugin from disk...
78 |
79 |
80 | ## 使用说明
81 |
82 | - 如果使用了zookeeper 请搭建好zookeeper服务器
83 | - 启动前 先修改生成项目 application.properties中的数据库连接配置 改成自己的数据库配置
84 | - 如果要跑生成例子中的testcase 请将项目下的schema.sql 在数据库中执行下
85 |
86 | 该插件生成的例子为:https://github.com/gejun123456/dubboSpringbootDemo
87 |
88 |
89 | ## 插件交流
90 |
91 | qq群号:796916754
92 |
93 |
94 | ## 我的其他插件
95 |
96 | - MybatisCodeHelperPro https://github.com/gejun123456/MyBatisCodeHelper-Pro
97 |
98 | - generateAllSetter https://github.com/gejun123456/intellij-generateAllSetMethod
99 |
100 | - StackOverFlow https://github.com/gejun123456/IntellijGoToStackOverFlow
101 |
102 |
103 |
104 | [plugin]: https://plugins.jetbrains.com/plugin/10946
105 |
106 |
107 |
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/src/test/resources/project/maven/kotlin-java6-pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.2.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.6
25 | 1.1.1
26 |
27 |
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-starter
32 |
33 |
34 | org.jetbrains.kotlin
35 | kotlin-stdlib
36 | ${kotlin.version}
37 |
38 |
39 | org.jetbrains.kotlin
40 | kotlin-reflect
41 | ${kotlin.version}
42 |
43 |
44 |
45 | org.springframework.boot
46 | spring-boot-starter-test
47 | test
48 |
49 |
50 |
51 |
52 | ${project.basedir}/src/main/kotlin
53 | ${project.basedir}/src/test/kotlin
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-maven-plugin
58 |
59 |
60 | kotlin-maven-plugin
61 | org.jetbrains.kotlin
62 | ${kotlin.version}
63 |
64 |
65 | -Xjsr305=strict
66 |
67 |
68 | spring
69 |
70 |
71 |
72 |
73 | compile
74 | compile
75 |
76 | compile
77 |
78 |
79 |
80 | test-compile
81 | test-compile
82 |
83 | test-compile
84 |
85 |
86 |
87 |
88 |
89 | org.jetbrains.kotlin
90 | kotlin-maven-allopen
91 | ${kotlin.version}
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/src/test/resources/project/maven/kotlin-java7-pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.2.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.7
25 | 1.1.1
26 |
27 |
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-starter
32 |
33 |
34 | org.jetbrains.kotlin
35 | kotlin-stdlib-jdk7
36 | ${kotlin.version}
37 |
38 |
39 | org.jetbrains.kotlin
40 | kotlin-reflect
41 | ${kotlin.version}
42 |
43 |
44 |
45 | org.springframework.boot
46 | spring-boot-starter-test
47 | test
48 |
49 |
50 |
51 |
52 | ${project.basedir}/src/main/kotlin
53 | ${project.basedir}/src/test/kotlin
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-maven-plugin
58 |
59 |
60 | kotlin-maven-plugin
61 | org.jetbrains.kotlin
62 | ${kotlin.version}
63 |
64 |
65 | -Xjsr305=strict
66 |
67 |
68 | spring
69 |
70 |
71 |
72 |
73 | compile
74 | compile
75 |
76 | compile
77 |
78 |
79 |
80 | test-compile
81 | test-compile
82 |
83 | test-compile
84 |
85 |
86 |
87 |
88 |
89 | org.jetbrains.kotlin
90 | kotlin-maven-allopen
91 | ${kotlin.version}
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/standard/pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.2.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 | 1.1.1
26 |
27 |
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-starter
32 |
33 |
34 | org.jetbrains.kotlin
35 | kotlin-stdlib-jdk8
36 | ${kotlin.version}
37 |
38 |
39 | org.jetbrains.kotlin
40 | kotlin-reflect
41 | ${kotlin.version}
42 |
43 |
44 |
45 | org.springframework.boot
46 | spring-boot-starter-test
47 | test
48 |
49 |
50 |
51 |
52 | ${project.basedir}/src/main/kotlin
53 | ${project.basedir}/src/test/kotlin
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-maven-plugin
58 |
59 |
60 | kotlin-maven-plugin
61 | org.jetbrains.kotlin
62 | ${kotlin.version}
63 |
64 |
65 | -Xjsr305=strict
66 |
67 |
68 | spring
69 |
70 | 1.8
71 |
72 |
73 |
74 | compile
75 | compile
76 |
77 | compile
78 |
79 |
80 |
81 | test-compile
82 | test-compile
83 |
84 | test-compile
85 |
86 |
87 |
88 |
89 |
90 | org.jetbrains.kotlin
91 | kotlin-maven-allopen
92 | ${kotlin.version}
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/src/main/java/com/bruce/dubboplugin/form/ChooseDubboConfigurationStep.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2017-2018 the original author or authors.
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package com.bruce.dubboplugin.form;
20 | import com.bruce.dubboplugin.dto.Dependency;
21 | import com.bruce.dubboplugin.dto.DependencyConstant;
22 | import com.google.common.collect.Lists;
23 |
24 | import com.bruce.dubboplugin.DubboPluginModuleBuilder;
25 | import com.bruce.dubboplugin.dto.PreConfig;
26 | import com.intellij.ide.util.projectWizard.ModuleWizardStep;
27 | import com.intellij.ide.wizard.StepAdapter;
28 | import com.intellij.openapi.Disposable;
29 | import org.jetbrains.annotations.Nullable;
30 |
31 | import javax.swing.*;
32 | import java.awt.event.ActionEvent;
33 | import java.awt.event.ActionListener;
34 |
35 | public class ChooseDubboConfigurationStep extends ModuleWizardStep implements Disposable {
36 |
37 | private DubboPluginModuleBuilder myBuilder;
38 | private JPanel panel1;
39 | private JRadioButton dubboSpringBootMybatisMysqlRadioButton;
40 | private JRadioButton createNewRadioButton;
41 |
42 |
43 | public ChooseDubboConfigurationStep(DubboPluginModuleBuilder builder, @Nullable StepAdapter stepAdapter) {
44 | this.myBuilder = builder;
45 | initComponents();
46 | }
47 |
48 | private void initComponents() {
49 | ButtonGroup group = new ButtonGroup();
50 | group.add(dubboSpringBootMybatisMysqlRadioButton);
51 | group.add(createNewRadioButton);
52 | final PreConfig preConfig = new PreConfig();
53 | preConfig.setDependencies(Lists.newArrayList(DependencyConstant.MYBAITS,DependencyConstant.MYSQL
54 | ,DependencyConstant.HIKARI,DependencyConstant.ZOOKEEPER,DependencyConstant.PAGE_HELPER));
55 | myBuilder.setPreConfig(preConfig);
56 | dubboSpringBootMybatisMysqlRadioButton.addActionListener(new ActionListener() {
57 | @Override
58 | public void actionPerformed(ActionEvent e) {
59 | preConfig.setDependencies(Lists.newArrayList(DependencyConstant.MYBAITS,DependencyConstant.MYSQL
60 | ,DependencyConstant.HIKARI,DependencyConstant.ZOOKEEPER,DependencyConstant.PAGE_HELPER));
61 | myBuilder.setPreConfig(preConfig);
62 | }
63 | });
64 |
65 | createNewRadioButton.addActionListener(new ActionListener() {
66 | @Override
67 | public void actionPerformed(ActionEvent e) {
68 | preConfig.setDependencies(Lists.newArrayList());
69 | myBuilder.setPreConfig(preConfig);
70 | }
71 | });
72 | }
73 |
74 | @Override
75 | public JComponent getComponent() {
76 | return panel1;
77 | }
78 |
79 | @Override
80 | public void updateDataModel() {
81 |
82 | }
83 |
84 | @Override
85 | public void dispose() {
86 |
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/main/java/com/bruce/dubboplugin/helper/DependencyHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2017-2018 the original author or authors.
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package com.bruce.dubboplugin.helper;
20 |
21 | import com.bruce.dubboplugin.dto.Dependency;
22 | import com.bruce.dubboplugin.dto.DependencyConstant;
23 | import com.google.common.collect.Lists;
24 |
25 | import java.util.HashMap;
26 | import java.util.List;
27 | import java.util.Map;
28 |
29 | public class DependencyHelper {
30 | private static Map> dependencyMap = new HashMap>() {{
31 | put(DependencyConstant.MYBAITS, Lists.newArrayList(Dependency.builder().groupId("org.mybatis.spring.boot").artifactId("mybatis-spring-boot-starter").version("1.3.2").build()));
32 | put(DependencyConstant.DUBBO, Lists.newArrayList(Dependency.builder().groupId("com.alibaba.boot").artifactId("dubbo-spring-boot-starter").version("0.1.0").build()));
33 | put(DependencyConstant.FASTJSON, Lists.newArrayList(Dependency.builder().groupId("com.alibaba").artifactId("fastjson").version("1.2.47").build()));
34 | put(DependencyConstant.MYSQL, Lists.newArrayList(Dependency.builder().groupId("mysql").artifactId("mysql-connector-java").scope(Dependency.SCOPE_RUNTIME).build()));
35 | put(DependencyConstant.LOMBOK, Lists.newArrayList(Dependency.builder().groupId("org.projectlombok").artifactId("lombok").scope(Dependency.SCOPE_COMPILE_ONLY).version("1.16.6").build()));
36 | put(DependencyConstant.REDIS, Lists.newArrayList(Dependency.builder().groupId("org.springframework.boot").artifactId("spring-boot-starter-data-redis").build()));
37 | put(DependencyConstant.RABBIT_MQ, Lists.newArrayList(Dependency.builder().groupId("org.springframework.boot").artifactId("spring-boot-starter-amqp").build()));
38 | put(DependencyConstant.SPRING_RETRY, Lists.newArrayList(Dependency.builder().groupId("org.springframework.retry").artifactId("spring-retry").version("1.3.0.RELEASE").build()));
39 | put(DependencyConstant.ZOOKEEPER, Lists.newArrayList());
40 | put(DependencyConstant.WEB_TOMCAT, Lists.newArrayList(Dependency.builder().groupId("org.springframework.boot").artifactId("spring-boot-starter-web").build()));
41 | put(DependencyConstant.PAGE_HELPER, Lists.newArrayList(Dependency.builder().groupId("com.github.pagehelper").artifactId("pagehelper-spring-boot-starter").version("1.2.5").build()));
42 | put(DependencyConstant.COMMON_LANGS_3, Lists.newArrayList(Dependency.builder().groupId("org.apache.commons").artifactId("commons-lang3").version("3.7").build()));
43 | put(DependencyConstant.HIKARI, Lists.newArrayList(Dependency.builder().groupId("com.zaxxer").artifactId("HikariCP").version("2.6.0").build()));
44 | }};
45 |
46 | public static List findDependency(String dependency) {
47 | return dependencyMap.get(dependency);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/test/resources/project/kotlin/war/pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | war
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.2.3.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 | 1.1.1
26 |
27 |
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-starter-web
32 |
33 |
34 | org.jetbrains.kotlin
35 | kotlin-stdlib-jdk8
36 | ${kotlin.version}
37 |
38 |
39 | org.jetbrains.kotlin
40 | kotlin-reflect
41 | ${kotlin.version}
42 |
43 |
44 |
45 | org.springframework.boot
46 | spring-boot-starter-tomcat
47 | provided
48 |
49 |
50 | org.springframework.boot
51 | spring-boot-starter-test
52 | test
53 |
54 |
55 |
56 |
57 | ${project.basedir}/src/main/kotlin
58 | ${project.basedir}/src/test/kotlin
59 |
60 |
61 | org.springframework.boot
62 | spring-boot-maven-plugin
63 |
64 |
65 | kotlin-maven-plugin
66 | org.jetbrains.kotlin
67 | ${kotlin.version}
68 |
69 |
70 | -Xjsr305=strict
71 |
72 |
73 | spring
74 |
75 | 1.8
76 |
77 |
78 |
79 | compile
80 | compile
81 |
82 | compile
83 |
84 |
85 |
86 | test-compile
87 | test-compile
88 |
89 | test-compile
90 |
91 |
92 |
93 |
94 |
95 | org.jetbrains.kotlin
96 | kotlin-maven-allopen
97 | ${kotlin.version}
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/src/test/resources/metadata/config/test-min.json:
--------------------------------------------------------------------------------
1 | {
2 | "configuration": {
3 | "env": {
4 | "forceSsl": false
5 | }
6 | },
7 | "dependencies": {
8 | "id": "dependencies",
9 | "type": "HIERARCHICAL_MULTI_SELECT",
10 | "description": null,
11 | "content": [
12 | {
13 | "name": "Core",
14 | "content": [
15 | {
16 | "name": "test",
17 | "id": "test",
18 | "groupId": "org.springframework.boot",
19 | "artifactId": "spring-boot-starter-test"
20 | }
21 | ]
22 | }
23 | ]
24 | },
25 | "types": {
26 | "id": "type",
27 | "type": "ACTION",
28 | "description": null,
29 | "content": [
30 | {
31 | "name": "Maven POM",
32 | "id": "maven-build",
33 | "description": null,
34 | "stsId": "pom.xml",
35 | "action": "/pom.xml",
36 | "tags": {
37 | "build": "maven",
38 | "format": "build"
39 | },
40 | "default": false
41 | }
42 | ]
43 | },
44 | "bootVersions": {
45 | "id": "bootVersion",
46 | "type": "SINGLE_SELECT",
47 | "description": null,
48 | "content": [
49 | {
50 | "name": "1.1.4",
51 | "id": "1.1.4.RELEASE",
52 | "default": true
53 | },
54 | {
55 | "name": "1.0.2",
56 | "id": "1.0.2.RELEASE",
57 | "default": false
58 | }
59 | ]
60 | },
61 | "packagings": {
62 | "id": "packaging",
63 | "type": "SINGLE_SELECT",
64 | "description": null,
65 | "content": [
66 | {
67 | "name": "Jar",
68 | "id": "jar",
69 | "default": true
70 | },
71 | {
72 | "name": "War",
73 | "id": "war",
74 | "default": false
75 | }
76 | ]
77 | },
78 | "javaVersions": {
79 | "id": "javaVersion",
80 | "type": "SINGLE_SELECT",
81 | "description": null,
82 | "content": [
83 | {
84 | "name": "1.8",
85 | "id": "1.8",
86 | "default": true
87 | }
88 | ]
89 | },
90 | "languages": {
91 | "id": "language",
92 | "type": "SINGLE_SELECT",
93 | "description": null,
94 | "content": [
95 | {
96 | "name": "Groovy",
97 | "id": "groovy",
98 | "default": false
99 | },
100 | {
101 | "name": "Java",
102 | "id": "java",
103 | "default": true
104 | },
105 | {
106 | "name": "Kotlin",
107 | "id": "kotlin",
108 | "default": false
109 | }
110 | ]
111 | },
112 | "name": {
113 | "id": "name",
114 | "type": "TEXT",
115 | "description": null,
116 | "content": "metadata-merge"
117 | },
118 | "description": {
119 | "id": "description",
120 | "type": "TEXT",
121 | "description": null,
122 | "content": "Demo project for metadata merge"
123 | },
124 | "groupId": {
125 | "id": "groupId",
126 | "type": "TEXT",
127 | "description": null,
128 | "content": "org.acme"
129 | },
130 | "artifactId": {
131 | "id": "artifactId",
132 | "type": "TEXT",
133 | "description": null,
134 | "content": "metadata"
135 | },
136 | "version": {
137 | "id": "version",
138 | "type": "TEXT",
139 | "description": null,
140 | "content": "1.0.0-SNAPSHOT"
141 | },
142 | "packageName": {
143 | "id": "packageName",
144 | "type": "TEXT",
145 | "description": null,
146 | "content": "org.acme.demo"
147 | }
148 | }
--------------------------------------------------------------------------------
/src/main/java/com/bruce/dubboplugin/helper/TemplateRenderer.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2017-2018 the original author or authors.
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package com.bruce.dubboplugin.helper;
20 |
21 | import com.samskivert.mustache.Mustache;
22 | import com.samskivert.mustache.Mustache.TemplateLoader;
23 | import com.samskivert.mustache.Template;
24 | import org.slf4j.Logger;
25 | import org.slf4j.LoggerFactory;
26 |
27 | import java.io.InputStreamReader;
28 | import java.io.Reader;
29 | import java.nio.charset.Charset;
30 | import java.util.Map;
31 | import java.util.concurrent.ConcurrentHashMap;
32 | import java.util.concurrent.ConcurrentMap;
33 |
34 | /**
35 | * A template renderer backed by Mustache.
36 | *
37 | * @author Dave Syer
38 | */
39 | public class TemplateRenderer {
40 |
41 | private static final Logger log = LoggerFactory.getLogger(TemplateRenderer.class);
42 |
43 | private boolean cache = true;
44 |
45 | private final Mustache.Compiler mustache;
46 |
47 |
48 | public static TemplateRenderer INSTANCE = new TemplateRenderer();
49 |
50 | private final ConcurrentMap templateCaches = new ConcurrentHashMap<>();
51 |
52 | public TemplateRenderer() {
53 | this(mustacheCompiler());
54 | }
55 |
56 | public TemplateRenderer(Mustache.Compiler mustache) {
57 | this.mustache = mustache;
58 | }
59 |
60 | public boolean isCache() {
61 | return this.cache;
62 | }
63 |
64 | public void setCache(boolean cache) {
65 | this.cache = cache;
66 | }
67 |
68 | public String process(String name, Map model) {
69 | try {
70 | Template template = getTemplate(name);
71 | return template.execute(model);
72 | } catch (Exception e) {
73 | System.out.println(CommonUtils.printStackTrace(e));
74 | log.error("Cannot render: " + name, e);
75 | throw new IllegalStateException("Cannot render template", e);
76 | }
77 | }
78 |
79 | public Template getTemplate(String name) {
80 | if (this.cache) {
81 | return this.templateCaches.computeIfAbsent(name, this::loadTemplate);
82 | }
83 | return loadTemplate(name);
84 | }
85 |
86 | protected Template loadTemplate(String name) {
87 | try {
88 | Reader template;
89 | template = this.mustache.loader.getTemplate(name);
90 | return this.mustache.compile(template);
91 | } catch (Exception e) {
92 | throw new IllegalStateException("Cannot load template " + name, e);
93 | }
94 | }
95 |
96 | private static Mustache.Compiler mustacheCompiler() {
97 | return Mustache.compiler().withLoader(mustacheTemplateLoader());
98 | }
99 |
100 | private static TemplateLoader mustacheTemplateLoader() {
101 | String prefix = "/templates/";
102 | Charset charset = Charset.forName("UTF-8");
103 | return (name) -> new InputStreamReader(
104 | TemplateRenderer.class.getResourceAsStream(prefix + name), charset);
105 | }
106 |
107 | }
108 |
--------------------------------------------------------------------------------
/src/test/resources/project/maven/kotlin-java9-pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.0.0.M6
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 9
25 | 1.1.1
26 |
27 |
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-starter
32 |
33 |
34 | org.jetbrains.kotlin
35 | kotlin-stdlib-jdk8
36 |
37 |
38 | org.jetbrains.kotlin
39 | kotlin-reflect
40 |
41 |
42 |
43 | org.springframework.boot
44 | spring-boot-starter-test
45 | test
46 |
47 |
48 |
49 |
50 | ${project.basedir}/src/main/kotlin
51 | ${project.basedir}/src/test/kotlin
52 |
53 |
54 | org.springframework.boot
55 | spring-boot-maven-plugin
56 |
57 |
58 | kotlin-maven-plugin
59 | org.jetbrains.kotlin
60 |
61 |
62 | -Xjsr305=strict
63 |
64 |
65 | spring
66 |
67 |
68 |
69 |
70 | org.jetbrains.kotlin
71 | kotlin-maven-allopen
72 | ${kotlin.version}
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | spring-snapshots
82 | Spring Snapshots
83 | https://repo.spring.io/snapshot
84 |
85 | true
86 |
87 |
88 |
89 | spring-milestones
90 | Spring Milestones
91 | https://repo.spring.io/milestone
92 |
93 | false
94 |
95 |
96 |
97 |
98 |
99 |
100 | spring-snapshots
101 | Spring Snapshots
102 | https://repo.spring.io/snapshot
103 |
104 | true
105 |
106 |
107 |
108 | spring-milestones
109 | Spring Milestones
110 | https://repo.spring.io/milestone
111 |
112 | false
113 |
114 |
115 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/src/main/resources/templates/starter-build.gradle:
--------------------------------------------------------------------------------
1 | package templates
2 |
3 | buildscript {
4 | ext {
5 | {{#buildPropertiesGradle}}
6 | {{key}} = '{{value}}'
7 | {{/buildPropertiesGradle}}
8 | }
9 | repositories {
10 | mavenCentral()
11 | {{^isRelease}}
12 | maven { url "https://repo.spring.io/snapshot" }
13 | maven { url "https://repo.spring.io/milestone" }
14 | {{/isRelease}}
15 | }
16 | dependencies {
17 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
18 | {{^bootOneThreeAvailable}}
19 | classpath('io.spring.gradle:dependency-management-plugin:{{dependencyManagementPluginVersion}}')
20 | {{/bootOneThreeAvailable}}
21 | {{#kotlin}}
22 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
23 | classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
24 | {{/kotlin}}
25 | }
26 | }
27 |
28 | apply plugin: '{{language}}'
29 | {{#kotlin}}
30 | apply plugin: 'kotlin-spring'
31 | {{/kotlin}}
32 | {{#war}}
33 | apply plugin: 'eclipse-wtp'
34 | {{/war}}
35 | {{^war}}
36 | apply plugin: 'eclipse'
37 | {{/war}}
38 | apply plugin: '{{springBootPluginName}}'
39 | {{^bootOneThreeAvailable}}
40 | apply plugin: 'io.spring.dependency-management'
41 | {{/bootOneThreeAvailable}}
42 | {{#bootTwoZeroAvailable}}
43 | apply plugin: 'io.spring.dependency-management'
44 | {{/bootTwoZeroAvailable}}
45 | {{#war}}
46 | apply plugin: 'war'
47 | {{/war}}
48 |
49 | group = '{{groupId}}'
50 | version = '{{version}}'
51 | sourceCompatibility = {{javaVersion}}{{#kotlin}}
52 | compileKotlin {
53 | kotlinOptions {
54 | freeCompilerArgs = ["-Xjsr305=strict"]{{#java8OrLater}}
55 | jvmTarget = "1.8"{{/java8OrLater}}
56 | }
57 | }
58 | compileTestKotlin {
59 | kotlinOptions {
60 | freeCompilerArgs = ["-Xjsr305=strict"]{{#java8OrLater}}
61 | jvmTarget = "1.8"{{/java8OrLater}}
62 | }
63 | }{{/kotlin}}
64 |
65 | repositories {
66 | mavenCentral()
67 | {{#repositoryValues}}
68 | maven { url "{{value.url}}" }
69 | {{/repositoryValues}}
70 | }
71 |
72 | {{#providedDependencies}}
73 | configurations {
74 | providedRuntime
75 | }
76 | {{/providedDependencies}}
77 |
78 | {{^buildPropertiesVersions.empty}}
79 | ext {
80 | {{#buildPropertiesVersions}}
81 | {{key}} = '{{value}}'
82 | {{/buildPropertiesVersions}}
83 | }
84 |
85 | {{/buildPropertiesVersions.empty}}
86 | dependencies {
87 | {{#compileDependencies}}
88 | compile('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
89 | {{/compileDependencies}}
90 | {{#groovy}}
91 | compile('org.codehaus.groovy:groovy')
92 | {{/groovy}}
93 | {{#kotlin}}
94 | compile("org.jetbrains.kotlin:{{kotlinStdlibArtifactId}}{{^kotlinSupport}}:${kotlinVersion}{{/kotlinSupport}}")
95 | compile("org.jetbrains.kotlin:kotlin-reflect{{^kotlinSupport}}:${kotlinVersion}{{/kotlinSupport}}")
96 | {{/kotlin}}
97 | {{#runtimeDependencies}}
98 | runtime('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
99 | {{/runtimeDependencies}}
100 | {{#compileOnlyDependencies}}
101 | compileOnly('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
102 | {{/compileOnlyDependencies}}
103 | {{#providedDependencies}}
104 | providedRuntime('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
105 | {{/providedDependencies}}
106 | testCompile('org.springframework.boot:spring-boot-starter-test')
107 | {{#testDependencies}}
108 | testCompile('{{groupId}}:{{artifactId}}{{#version}}:{{version}}{{/version}}{{#type}}@{{type}}{{/type}}')
109 | {{/testDependencies}}
110 | }
111 | {{#hasBoms}}
112 |
113 | dependencyManagement {
114 | imports {
115 | {{#reversedBoms}}
116 | mavenBom "{{groupId}}:{{artifactId}}:{{versionToken}}"
117 | {{/reversedBoms}}
118 | }
119 | }
120 | {{/hasBoms}}
--------------------------------------------------------------------------------
/src/test/resources/project/maven/kotlin-springboot2-pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.0.0.M6
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 | 1.1.1
26 |
27 |
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-starter
32 |
33 |
34 | org.jetbrains.kotlin
35 | kotlin-stdlib-jdk8
36 |
37 |
38 | org.jetbrains.kotlin
39 | kotlin-reflect
40 |
41 |
42 |
43 | org.springframework.boot
44 | spring-boot-starter-test
45 | test
46 |
47 |
48 |
49 |
50 | ${project.basedir}/src/main/kotlin
51 | ${project.basedir}/src/test/kotlin
52 |
53 |
54 | org.springframework.boot
55 | spring-boot-maven-plugin
56 |
57 |
58 | kotlin-maven-plugin
59 | org.jetbrains.kotlin
60 |
61 |
62 | -Xjsr305=strict
63 |
64 |
65 | spring
66 |
67 |
68 |
69 |
70 | org.jetbrains.kotlin
71 | kotlin-maven-allopen
72 | ${kotlin.version}
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | spring-snapshots
82 | Spring Snapshots
83 | https://repo.spring.io/snapshot
84 |
85 | true
86 |
87 |
88 |
89 | spring-milestones
90 | Spring Milestones
91 | https://repo.spring.io/milestone
92 |
93 | false
94 |
95 |
96 |
97 |
98 |
99 |
100 | spring-snapshots
101 | Spring Snapshots
102 | https://repo.spring.io/snapshot
103 |
104 | true
105 |
106 |
107 |
108 | spring-milestones
109 | Spring Milestones
110 | https://repo.spring.io/milestone
111 |
112 | false
113 |
114 |
115 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/src/test/resources/project/maven/kotlin-springboot2-legacy-pom.xml.gen:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.0.0.M5
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 | 1.1.1
26 |
27 |
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-starter
32 |
33 |
34 | org.jetbrains.kotlin
35 | kotlin-stdlib-jdk8
36 | ${kotlin.version}
37 |
38 |
39 | org.jetbrains.kotlin
40 | kotlin-reflect
41 | ${kotlin.version}
42 |
43 |
44 |
45 | org.springframework.boot
46 | spring-boot-starter-test
47 | test
48 |
49 |
50 |
51 |
52 | ${project.basedir}/src/main/kotlin
53 | ${project.basedir}/src/test/kotlin
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-maven-plugin
58 |
59 |
60 | kotlin-maven-plugin
61 | org.jetbrains.kotlin
62 | ${kotlin.version}
63 |
64 |
65 | -Xjsr305=strict
66 |
67 |
68 | spring
69 |
70 | 1.8
71 |
72 |
73 |
74 | compile
75 | compile
76 |
77 | compile
78 |
79 |
80 |
81 | test-compile
82 | test-compile
83 |
84 | test-compile
85 |
86 |
87 |
88 |
89 |
90 | org.jetbrains.kotlin
91 | kotlin-maven-allopen
92 | ${kotlin.version}
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | spring-snapshots
102 | Spring Snapshots
103 | https://repo.spring.io/snapshot
104 |
105 | true
106 |
107 |
108 |
109 | spring-milestones
110 | Spring Milestones
111 | https://repo.spring.io/milestone
112 |
113 | false
114 |
115 |
116 |
117 |
118 |
119 |
120 | spring-snapshots
121 | Spring Snapshots
122 | https://repo.spring.io/snapshot
123 |
124 | true
125 |
126 |
127 |
128 | spring-milestones
129 | Spring Milestones
130 | https://repo.spring.io/milestone
131 |
132 | false
133 |
134 |
135 |
136 |
137 |
138 |
139 |
--------------------------------------------------------------------------------
/src/main/resources/templates/TestModelMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | id,
16 | age,
17 | user_name,
18 | created_at,
19 | updated_at
20 |
21 |
22 |
23 |
24 | INSERT INTO test_model (
25 | id,
26 | age,
27 | user_name,
28 | created_at,
29 | updated_at
30 | ) VALUES (
31 | #{testModel.id,jdbcType=INTEGER},
32 | #{testModel.age,jdbcType=INTEGER},
33 | #{testModel.userName,jdbcType=VARCHAR},
34 | #{testModel.createdAt,jdbcType=TIMESTAMP},
35 | #{testModel.updatedAt,jdbcType=TIMESTAMP}
36 | )
37 |
38 |
39 |
40 |
41 | INSERT INTO test_model
42 |
43 | id,
44 | age,
45 | user_name,
46 | created_at,
47 | updated_at,
48 |
49 | VALUES
50 |
51 | #{testModel.id,jdbcType=INTEGER},
52 |
53 | #{testModel.age,jdbcType=INTEGER},
54 |
55 | #{testModel.userName,jdbcType=VARCHAR},
56 |
57 | #{testModel.createdAt,jdbcType=TIMESTAMP},
58 |
59 | #{testModel.updatedAt,jdbcType=TIMESTAMP},
60 |
61 |
62 |
63 |
64 |
65 |
66 | INSERT INTO test_model (
67 |
68 | )VALUES
69 |
70 | (
71 | #{testModel.id,jdbcType=INTEGER},
72 | #{testModel.age,jdbcType=INTEGER},
73 | #{testModel.userName,jdbcType=VARCHAR},
74 | #{testModel.createdAt,jdbcType=TIMESTAMP},
75 | #{testModel.updatedAt,jdbcType=TIMESTAMP}
76 | )
77 |
78 |
79 |
80 |
81 |
82 | UPDATE test_model
83 |
84 | id= #{testModel.id,jdbcType=INTEGER},
85 | age= #{testModel.age,jdbcType=INTEGER},
86 | user_name= #{testModel.userName,jdbcType=VARCHAR},
87 | created_at= #{testModel.createdAt,jdbcType=TIMESTAMP},
88 | updated_at= #{testModel.updatedAt,jdbcType=TIMESTAMP}
89 |
90 | WHERE id = #{testModel.id,jdbcType=VARCHAR}
91 |
92 |
93 | {{#dep_pagehelper}}
94 |
95 |
101 | {{/dep_pagehelper}}
102 |
103 |
104 |
--------------------------------------------------------------------------------
/src/test/resources/application-test-default.yml:
--------------------------------------------------------------------------------
1 | info:
2 | spring-boot:
3 | version: 1.1.4.RELEASE
4 |
5 | initializr:
6 | env:
7 | boms:
8 | my-api-bom:
9 | groupId: org.acme
10 | artifactId: my-api-bom
11 | versionProperty: my-api.version
12 | additionalBoms: ['my-api-dependencies-bom']
13 | mappings:
14 | - versionRange: "[1.0.0.RELEASE,1.1.6.RELEASE)"
15 | version: 1.0.0.RELEASE
16 | repositories: my-api-repo-1
17 | - versionRange: "1.2.1.RELEASE"
18 | version: 2.0.0.RELEASE
19 | repositories: my-api-repo-2
20 | my-api-dependencies-bom:
21 | groupId: org.acme
22 | artifactId: my-api-dependencies-bom
23 | version: 1.0.0.RELEASE
24 | repositories: my-api-repo-3
25 | kotlin:
26 | defaultVersion: 1.2
27 | mappings:
28 | - versionRange: "[1.0.0.RELEASE,1.2.0.RELEASE)"
29 | version: 1.0
30 | - versionRange: "[1.2.0.RELEASE,1.5.0.RELEASE)"
31 | version: 1.1
32 | repositories:
33 | my-api-repo-1:
34 | name: repo1
35 | url: http://example.com/repo1
36 | my-api-repo-2:
37 | name: repo2
38 | url: http://example.com/repo2
39 | my-api-repo-3:
40 | name: repo3
41 | url: http://example.com/repo3
42 | dependencies:
43 | - name: Core
44 | content:
45 | - name: Web
46 | id: web
47 | description: Web dependency description
48 | facets:
49 | - web
50 | links:
51 | - rel: guide
52 | href: https://example.com/guide
53 | description: Building a RESTful Web Service
54 | - rel: reference
55 | href: https://example.com/doc
56 | - name: Security
57 | id: security
58 | - name: Data JPA
59 | id: data-jpa
60 | aliases:
61 | - jpa
62 | - name: Other
63 | content:
64 | - name: Foo
65 | groupId: org.acme
66 | artifactId: foo
67 | version: 1.3.5
68 | weight: 42
69 | keywords:
70 | - thefoo
71 | - dafoo
72 | links:
73 | - rel: guide
74 | href: https://example.com/guide1
75 | - rel: reference
76 | href: https://example.com/{bootVersion}/doc
77 | - rel: guide
78 | href: https://example.com/guide2
79 | description: Some guide for foo
80 | - name: Bar
81 | id: org.acme:bar
82 | version: 2.1.0
83 | - name: Biz
84 | groupId: org.acme
85 | artifactId: biz
86 | scope: runtime
87 | version: 1.3.5
88 | versionRange: 1.2.0.BUILD-SNAPSHOT
89 | - name: Bur
90 | id: org.acme:bur
91 | version: 2.1.0
92 | scope: test
93 | versionRange: "[1.1.4.RELEASE,1.2.0.BUILD-SNAPSHOT)"
94 | - name: My API
95 | id : my-api
96 | groupId: org.acme
97 | artifactId: my-api
98 | scope: provided
99 | bom: my-api-bom
100 | types:
101 | - name: Maven POM
102 | id: maven-build
103 | sts-id: pom.xml
104 | tags:
105 | build: maven
106 | format: build
107 | default: false
108 | action: /pom.xml
109 | - name: Maven Project
110 | id: maven-project
111 | sts-id: starter.zip
112 | tags:
113 | build: maven
114 | format: project
115 | default: true
116 | action: /starter.zip
117 | - name: Gradle Config
118 | id: gradle-build
119 | sts-id: build.gradle
120 | tags:
121 | build: gradle
122 | format: build
123 | default: false
124 | action: /build.gradle
125 | - name: Gradle Project
126 | id: gradle-project
127 | sts-id: gradle.zip
128 | tags:
129 | build: gradle
130 | format: project
131 | default: false
132 | action: /starter.zip
133 | packagings:
134 | - name: Jar
135 | id: jar
136 | default: true
137 | - name: War
138 | id: war
139 | default: false
140 | javaVersions:
141 | - id: 1.6
142 | default: false
143 | - id: 1.7
144 | default: false
145 | - id: 1.8
146 | default: true
147 | languages:
148 | - name: Groovy
149 | id: groovy
150 | default: false
151 | - name: Java
152 | id: java
153 | default: true
154 | - name: Kotlin
155 | id: kotlin
156 | default: false
157 | bootVersions:
158 | - name : Latest SNAPSHOT
159 | id: 1.2.0.BUILD-SNAPSHOT
160 | default: false
161 | - name: 1.1.4
162 | id: 1.1.4.RELEASE
163 | default: true
164 | - name: 1.0.2
165 | id: 1.0.2.RELEASE
166 | default: false
167 |
168 |
--------------------------------------------------------------------------------
/src/main/resources/project/maven/mvnw.cmd:
--------------------------------------------------------------------------------
1 | @REM ----------------------------------------------------------------------------
2 | @REM Licensed to the Apache Software Foundation (ASF) under one
3 | @REM or more contributor license agreements. See the NOTICE file
4 | @REM distributed with this work for additional information
5 | @REM regarding copyright ownership. The ASF licenses this file
6 | @REM to you under the Apache License, Version 2.0 (the
7 | @REM "License"); you may not use this file except in compliance
8 | @REM with the License. You may obtain a copy of the License at
9 | @REM
10 | @REM http://www.apache.org/licenses/LICENSE-2.0
11 | @REM
12 | @REM Unless required by applicable law or agreed to in writing,
13 | @REM software distributed under the License is distributed on an
14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | @REM KIND, either express or implied. See the License for the
16 | @REM specific language governing permissions and limitations
17 | @REM under the License.
18 | @REM ----------------------------------------------------------------------------
19 |
20 | @REM ----------------------------------------------------------------------------
21 | @REM Maven2 Start Up Batch script
22 | @REM
23 | @REM Required ENV vars:
24 | @REM JAVA_HOME - location of a JDK home dir
25 | @REM
26 | @REM Optional ENV vars
27 | @REM M2_HOME - location of maven2's installed home dir
28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
31 | @REM e.g. to debug Maven itself, use
32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34 | @REM ----------------------------------------------------------------------------
35 |
36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
37 | @echo off
38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
40 |
41 | @REM set %HOME% to equivalent of $HOME
42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
43 |
44 | @REM Execute a user defined script before this one
45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending
47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
49 | :skipRcPre
50 |
51 | @setlocal
52 |
53 | set ERROR_CODE=0
54 |
55 | @REM To isolate internal variables from possible post scripts, we use another setlocal
56 | @setlocal
57 |
58 | @REM ==== START VALIDATION ====
59 | if not "%JAVA_HOME%" == "" goto OkJHome
60 |
61 | echo.
62 | echo Error: JAVA_HOME not found in your environment. >&2
63 | echo Please set the JAVA_HOME variable in your environment to match the >&2
64 | echo location of your Java installation. >&2
65 | echo.
66 | goto error
67 |
68 | :OkJHome
69 | if exist "%JAVA_HOME%\bin\java.exe" goto init
70 |
71 | echo.
72 | echo Error: JAVA_HOME is set to an invalid directory. >&2
73 | echo JAVA_HOME = "%JAVA_HOME%" >&2
74 | echo Please set the JAVA_HOME variable in your environment to match the >&2
75 | echo location of your Java installation. >&2
76 | echo.
77 | goto error
78 |
79 | @REM ==== END VALIDATION ====
80 |
81 | :init
82 |
83 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
84 | @REM Fallback to current working directory if not found.
85 |
86 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
87 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
88 |
89 | set EXEC_DIR=%CD%
90 | set WDIR=%EXEC_DIR%
91 | :findBaseDir
92 | IF EXIST "%WDIR%"\.mvn goto baseDirFound
93 | cd ..
94 | IF "%WDIR%"=="%CD%" goto baseDirNotFound
95 | set WDIR=%CD%
96 | goto findBaseDir
97 |
98 | :baseDirFound
99 | set MAVEN_PROJECTBASEDIR=%WDIR%
100 | cd "%EXEC_DIR%"
101 | goto endDetectBaseDir
102 |
103 | :baseDirNotFound
104 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
105 | cd "%EXEC_DIR%"
106 |
107 | :endDetectBaseDir
108 |
109 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
110 |
111 | @setlocal EnableExtensions EnableDelayedExpansion
112 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
113 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
114 |
115 | :endReadAdditionalConfig
116 |
117 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
118 |
119 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
120 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
121 |
122 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
123 | if ERRORLEVEL 1 goto error
124 | goto end
125 |
126 | :error
127 | set ERROR_CODE=1
128 |
129 | :end
130 | @endlocal & set ERROR_CODE=%ERROR_CODE%
131 |
132 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
133 | @REM check for post script, once with legacy .bat ending and once with .cmd ending
134 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
135 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
136 | :skipRcPost
137 |
138 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
139 | if "%MAVEN_BATCH_PAUSE%" == "on" pause
140 |
141 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
142 |
143 | exit /B %ERROR_CODE%
144 |
--------------------------------------------------------------------------------
/src/main/resources/project/gradle/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn ( ) {
37 | echo "$*"
38 | }
39 |
40 | die ( ) {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/src/main/resources/project/gradle3/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn ( ) {
37 | echo "$*"
38 | }
39 |
40 | die ( ) {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save ( ) {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/src/main/resources/project/gradle4/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn ( ) {
37 | echo "$*"
38 | }
39 |
40 | die ( ) {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save ( ) {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/src/test/java/com/bruce/dubboplugin/GenerateUtilsTest.java:
--------------------------------------------------------------------------------
1 | package com.bruce.dubboplugin;
2 | import com.bruce.dubboplugin.dto.DependencyConstant;
3 | import com.google.common.collect.Lists;
4 | import com.bruce.dubboplugin.dto.UserChooseDependency;
5 |
6 | import com.bruce.dubboplugin.dto.GenerateContentContext;
7 | import com.bruce.dubboplugin.helper.GenerateContentUtils;
8 | import org.junit.Test;
9 |
10 | import java.io.File;
11 | import java.util.Arrays;
12 |
13 | public class GenerateUtilsTest {
14 | @Test
15 | public void testGenerateFilesAsProviderWithNoDependency(){
16 | GenerateContentContext contentContext = new GenerateContentContext();
17 | UserChooseDependency userChooseDependency = new UserChooseDependency();
18 | userChooseDependency.setUseMaven(true);
19 | userChooseDependency.setUseGradle(false);
20 | userChooseDependency.setBootVersion("1.5.7");
21 | userChooseDependency.setGroupId("com.example.lala");
22 | userChooseDependency.setArtifactId("demo");
23 | userChooseDependency.setUseJava(true);
24 | userChooseDependency.setUseKotlin(false);
25 | userChooseDependency.setDependencyList(Lists.newArrayList());
26 | userChooseDependency.setHasProvider(true);
27 | userChooseDependency.setApiArtifactId("demo-Api");
28 | userChooseDependency.setProviderArtifactId("demo-Provider");
29 | userChooseDependency.setHasWebSupport(false);
30 | contentContext.setUserChooseDependency(
31 | userChooseDependency);
32 | String rootPath = "D:\\code\\mygitlab\\dubboPlugin\\src\\test\\resources\\testFiles";
33 | deleteDirectory(new File(rootPath));
34 | contentContext.setRootPath(rootPath);
35 | GenerateContentUtils.generateFiles(
36 | contentContext);
37 | }
38 |
39 |
40 | @Test
41 | public void testGenerateFilesAsProviderWithAllDepedency(){
42 | GenerateContentContext contentContext = new GenerateContentContext();
43 | UserChooseDependency userChooseDependency = new UserChooseDependency();
44 | userChooseDependency.setUseMaven(true);
45 | userChooseDependency.setUseGradle(false);
46 | userChooseDependency.setBootVersion("1.5.7");
47 | userChooseDependency.setGroupId("com.example.lala");
48 | userChooseDependency.setArtifactId("demo");
49 | userChooseDependency.setUseJava(true);
50 | userChooseDependency.setUseKotlin(false);
51 | userChooseDependency.setDependencyList(Lists.newArrayList(DependencyConstant.MYBAITS,DependencyConstant.MYSQL,DependencyConstant.ZOOKEEPER,DependencyConstant.COMMON_LANGS_3,
52 | DependencyConstant.FASTJSON,DependencyConstant.LOMBOK,DependencyConstant.PAGE_HELPER,DependencyConstant.REDIS,DependencyConstant.SPRING_RETRY,DependencyConstant.WEB_TOMCAT,
53 | DependencyConstant.HIKARI,DependencyConstant.RABBIT_MQ));
54 | userChooseDependency.setHasProvider(true);
55 | userChooseDependency.setApiArtifactId("demo-Api");
56 | userChooseDependency.setProviderArtifactId("demo-Provider");
57 | userChooseDependency.setHasWebSupport(false);
58 | contentContext.setUserChooseDependency(
59 | userChooseDependency);
60 | String rootPath = "D:\\code\\mygitlab\\dubboPlugin\\src\\test\\resources\\testFiles";
61 | deleteDirectory(new File(rootPath));
62 | contentContext.setRootPath(rootPath);
63 | GenerateContentUtils.generateFiles(
64 | contentContext);
65 | }
66 |
67 |
68 | @Test
69 | public void testGenerateFilesAsProviderWithNoDependencyWithZookeeperDependency(){
70 | GenerateContentContext contentContext = new GenerateContentContext();
71 | UserChooseDependency userChooseDependency = new UserChooseDependency();
72 | userChooseDependency.setUseMaven(true);
73 | userChooseDependency.setUseGradle(false);
74 | userChooseDependency.setBootVersion("1.5.7");
75 | userChooseDependency.setGroupId("com.example.lala");
76 | userChooseDependency.setArtifactId("demo");
77 | userChooseDependency.setUseJava(true);
78 | userChooseDependency.setUseKotlin(false);
79 | userChooseDependency.setDependencyList(Lists.newArrayList(DependencyConstant.ZOOKEEPER));
80 | userChooseDependency.setHasProvider(true);
81 | userChooseDependency.setApiArtifactId("demoApi");
82 | userChooseDependency.setProviderArtifactId("demoProvider");
83 | userChooseDependency.setHasWebSupport(false);
84 | contentContext.setUserChooseDependency(
85 | userChooseDependency);
86 | String rootPath = "D:\\code\\mygitlab\\dubboPlugin\\src\\test\\resources\\testFiles";
87 | deleteDirectory(new File(rootPath));
88 | contentContext.setRootPath(rootPath);
89 | GenerateContentUtils.generateFiles(
90 | contentContext);
91 | }
92 |
93 | boolean deleteDirectory(File directoryToBeDeleted) {
94 | File[] allContents = directoryToBeDeleted.listFiles();
95 | if (allContents != null) {
96 | for (File file : allContents) {
97 | deleteDirectory(file);
98 | }
99 | }
100 | return directoryToBeDeleted.delete();
101 | }
102 |
103 |
104 | @Test
105 | public void testGenerateFileAsConsumerWihtNoDependencyTest(){
106 | GenerateContentContext contentContext = new GenerateContentContext();
107 | UserChooseDependency userChooseDependency = new UserChooseDependency();
108 | userChooseDependency.setUseMaven(true);
109 | userChooseDependency.setUseGradle(false);
110 | userChooseDependency.setBootVersion("1.5.7");
111 | userChooseDependency.setGroupId("com.example.lala");
112 | userChooseDependency.setArtifactId("demo");
113 | userChooseDependency.setUseJava(true);
114 | userChooseDependency.setUseKotlin(false);
115 | userChooseDependency.setDependencyList(Lists.newArrayList());
116 | userChooseDependency.setHasProvider(false);
117 | // userChooseDependency.setApiArtifactId("demoApi");
118 | // userChooseDependency.setProviderArtifactId("demoProvider");
119 | userChooseDependency.setHasWebSupport(false);
120 | contentContext.setUserChooseDependency(
121 | userChooseDependency);
122 | String rootPath = "D:\\code\\mygitlab\\dubboPlugin\\src\\test\\resources\\testFiles";
123 | deleteDirectory(new File(rootPath));
124 | contentContext.setRootPath(rootPath);
125 | GenerateContentUtils.generateFiles(
126 | contentContext);
127 | }
128 |
129 | }
130 |
--------------------------------------------------------------------------------
/src/main/java/com/bruce/dubboplugin/DubboPluginModuleBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2017-2018 the original author or authors.
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package com.bruce.dubboplugin;
20 |
21 | import com.bruce.dubboplugin.dto.GenerateContentContext;
22 | import com.bruce.dubboplugin.dto.PreConfig;
23 | import com.bruce.dubboplugin.dto.UserChooseDependency;
24 | import com.bruce.dubboplugin.form.ChooseDubboConfigurationStep;
25 | import com.bruce.dubboplugin.form.DubboModuleWizardStep;
26 | import com.bruce.dubboplugin.helper.GenerateContentUtils;
27 | import com.bruce.dubboplugin.helper.IconUtils;
28 | import com.google.gson.Gson;
29 | import com.intellij.ide.util.projectWizard.*;
30 | import com.intellij.openapi.Disposable;
31 | import com.intellij.openapi.module.JavaModuleType;
32 | import com.intellij.openapi.module.ModuleType;
33 | import com.intellij.openapi.module.StdModuleTypes;
34 | import com.intellij.openapi.options.ConfigurationException;
35 | import com.intellij.openapi.project.Project;
36 | import com.intellij.openapi.projectRoots.JavaSdk;
37 | import com.intellij.openapi.projectRoots.SdkTypeId;
38 | import com.intellij.openapi.roots.ModifiableRootModel;
39 | import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
40 | import com.intellij.openapi.util.Pair;
41 | import com.intellij.openapi.util.io.FileUtil;
42 | import com.intellij.openapi.vfs.LocalFileSystem;
43 | import com.intellij.openapi.vfs.VirtualFile;
44 | import org.jetbrains.annotations.NotNull;
45 | import org.jetbrains.annotations.Nullable;
46 |
47 | import javax.swing.*;
48 | import java.io.File;
49 | import java.util.Collections;
50 | import java.util.List;
51 |
52 | public class DubboPluginModuleBuilder extends ModuleBuilder implements SourcePathsBuilder {
53 |
54 | private PreConfig preConfig;
55 |
56 | private UserChooseDependency userChooseDependency;
57 |
58 | @Override
59 | public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
60 |
61 | String s = new Gson().toJson(userChooseDependency);
62 | System.out.println("set up root model json is:" + s);
63 | Project project = rootModel.getProject();
64 | VirtualFile root = createAndGetContentEntry();
65 | rootModel.addContentEntry(root);
66 | if (myJdk != null) {
67 | rootModel.setSdk(myJdk);
68 | } else {
69 | rootModel.inheritSdk();
70 | }
71 | System.out.println("start to create folder in path");
72 |
73 |
74 | }
75 |
76 | private VirtualFile createAndGetContentEntry() {
77 | String path = FileUtil.toSystemDependentName(getContentEntryPath());
78 | new File(path).mkdirs();
79 | return LocalFileSystem.getInstance().refreshAndFindFileByPath(path);
80 | }
81 |
82 | @Override
83 | public ModuleType getModuleType() {
84 | return StdModuleTypes.JAVA;
85 | }
86 |
87 | @Override
88 | public List> getSourcePaths() throws ConfigurationException {
89 | return Collections.emptyList();
90 | }
91 |
92 |
93 | @Override
94 | public void setSourcePaths(List> sourcePaths) {
95 |
96 | }
97 |
98 | @Override
99 | public void addSourcePath(Pair sourcePathInfo) {
100 |
101 | }
102 |
103 | @Override
104 | public String getGroupName() {
105 | return "Dubbo";
106 | }
107 |
108 | @Override
109 | public String getPresentableName() {
110 | return "Dubbo";
111 | }
112 |
113 | @Override
114 | public String getParentGroup() {
115 | return JavaModuleType.BUILD_TOOLS_GROUP;
116 | }
117 |
118 | @Override
119 | public int getWeight() {
120 | return JavaModuleBuilder.BUILD_SYSTEM_WEIGHT;
121 | }
122 |
123 |
124 | @Override
125 | public boolean isSuitableSdkType(SdkTypeId sdkType) {
126 | return sdkType == JavaSdk.getInstance();
127 | }
128 |
129 |
130 | @Override
131 | public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext, @NotNull ModulesProvider modulesProvider) {
132 | return new ModuleWizardStep[]{
133 | new DubboModuleWizardStep(this, wizardContext, !wizardContext.isNewWizard())
134 | };
135 | }
136 |
137 | @Nullable
138 | @Override
139 | public ModuleWizardStep getCustomOptionsStep(WizardContext context, Disposable parentDisposable) {
140 | return new ChooseDubboConfigurationStep(this, null);
141 | }
142 |
143 | @Override
144 | public ModuleWizardStep modifyStep(SettingsStep settingsStep) {
145 | return super.modifyStep(settingsStep);
146 | }
147 |
148 | @Nullable
149 | @Override
150 | public String getBuilderId() {
151 | return getClass().getName();
152 | }
153 |
154 |
155 | public PreConfig getPreConfig() {
156 | return preConfig;
157 | }
158 |
159 | public void setPreConfig(PreConfig preConfig) {
160 | this.preConfig = preConfig;
161 | }
162 |
163 | @Nullable
164 | @Override
165 | public ModuleWizardStep modifySettingsStep(@NotNull SettingsStep settingsStep) {
166 | ModuleNameLocationSettings moduleNameLocationSettings = settingsStep.getModuleNameLocationSettings();
167 | if (moduleNameLocationSettings != null && userChooseDependency != null && userChooseDependency.getArtifactId() != null) {
168 | moduleNameLocationSettings.setModuleName(userChooseDependency.getArtifactId());
169 | // moduleNameLocationSettings.setModuleContentRoot(moduleNameLocationSettings.getModuleContentRoot() + "/" + userChooseDependency.getArtifactId());
170 | }
171 | return super.modifySettingsStep(settingsStep);
172 | }
173 |
174 | public UserChooseDependency getUserChooseDependency() {
175 | return userChooseDependency;
176 | }
177 |
178 | public void setUserChooseDependency(UserChooseDependency userChooseDependency) {
179 | this.userChooseDependency = userChooseDependency;
180 | }
181 |
182 | @Override
183 | public Icon getNodeIcon() {
184 | return IconUtils.dubbonIcon;
185 | }
186 |
187 | @Nullable
188 | @Override
189 | public Project createProject(String name, String path) {
190 | GenerateContentContext contentContext = new GenerateContentContext();
191 | contentContext.setUserChooseDependency(userChooseDependency);
192 | contentContext.setRootPath(path);
193 | GenerateContentUtils.generateFiles(contentContext);
194 | return super.createProject(name,path);
195 | }
196 | }
197 |
--------------------------------------------------------------------------------