Go to http://start.spring.io/
Set group and package names,packaging(standalone(jar) or web(war)),project type(maven orgradle).
You can also select java version,language(java or groovy) and pre-add lots of dependencies(jpa,template engin,AOP and lote more :) ).
Click Generate project button and project will be downloaded as zip :)
Doing it in shell/command prompt:
so that we can get it done via script:
look at the generated pom.xml:-Doing it in shell/command prompt:
so that we can get it done via script:
- #generate & download
- spring init --build=maven --java-version=1.8 --dependencies=mail --packaging=jar skeleton.zip
- #unzip
- unzip skeleton.zip
- #remove zip
- rm -f skeleton.zip
- #we have our project in current directory :)
- cat pom.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.example</groupId>
- <artifactId>skeleton</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>demo</name>
- <description>Demo project for Spring Boot</description>
- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>1.4.0.RELEASE</version>
- <relativePath/> <!-- lookup parent from repository -->
- </parent>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <java.version>1.8</java.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-mail</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </project>
http://docs.spring.io/spring-boot/docs/current/reference/html/cli-using-the-cli.html#cli-init
No comments:
Post a Comment