Skip to content

Commit

Permalink
Merge pull request #2 from Bernardo-MG/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Bernardo-MG committed Jan 18, 2021
2 parents 2a1c569 + b1e09bd commit 106691b
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 34 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Expand Up @@ -15,7 +15,7 @@
<parent>
<groupId>com.bernardomg.maven</groupId>
<artifactId>archetype-pom</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
</parent>

<!-- ********************************************** -->
Expand All @@ -24,7 +24,7 @@

<groupId>com.bernardomg.maven.archetypes</groupId>
<artifactId>spring-mvc-angular-archetype</artifactId>
<version>1.0.0</version>
<version>1.1.0-SNAPSHOT</version>
<packaging>maven-archetype</packaging>

<name>Spring MVC with Angular Maven Archetype</name>
Expand Down Expand Up @@ -169,7 +169,7 @@
<!-- ============================================== -->
<!-- ================= MAVEN SITE ================= -->
<!-- ============================================== -->
<site.skin.version>2.0.8</site.skin.version>
<site.skin.version>2.0.10</site.skin.version>
<repoDownloadURL>https://dl.bintray.com/bernardo-mg/maven/</repoDownloadURL>
<bintrayURL>https://bintray.com/bernardo-mg/maven/spring-mvc-angular-maven-archetype/view</bintrayURL>
<mavenURL>http://mvnrepository.com/artifact/com.bernardomg.maven.archetypes/spring-mvc-angular-archetype</mavenURL>
Expand Down
7 changes: 0 additions & 7 deletions readme.md
Expand Up @@ -48,13 +48,6 @@ The application is coded in Java, using Maven to manage the project.

It is a Maven Archetype, and can be used through command line or an IDE as long as it is included in the local repository.

### Prerequisites

The project has been tested on the following Java versions:
* JDK 8

All other dependencies are handled through Maven, and noted in the included POM file.

### Installing

The best way to install the Archetype is by downloading it from the [Bintray repository][bintray-repo]. It can be acquired from the [Maven Central Repository][maven-repo] too, but it is not recommended.
Expand Down
Expand Up @@ -40,7 +40,7 @@ jobs:
DEPLOY_DOCS_DEVELOP_SITE: ${{ secrets.DEPLOY_DOCS_DEVELOP_SITE }}
- name: Deploy development docs
if: steps.extract_branch.outputs.branch == 'develop'
run: mvn verify site site:deploy -B -P deployment,deployment-development --settings settings.xml -Dspring.profiles.active=test,h2
run: mvn verify site site:deploy -B -P h2,development,deployment,deployment-development --settings settings.xml -Dspring.profiles.active=test,h2
- name: Deploy release docs
if: steps.extract_branch.outputs.branch == 'master'
run: mvn verify site site:deploy -B -P deployment,deployment-release --settings settings.xml -Dspring.profiles.active=test,h2
run: mvn verify site site:deploy -B -P h2,development,deployment,deployment-release --settings settings.xml -Dspring.profiles.active=test,h2
Expand Up @@ -10,6 +10,7 @@ jobs:
matrix:
jdk: [ 8, 11, 14 ]
db: [ h2, mysql, postgres ]
env: [ development, production ]

services:
mysql:
Expand Down Expand Up @@ -41,4 +42,4 @@ jobs:
with:
java-version: ${{ matrix.jdk }}
- name: Run all tests
run: mvn clean verify -P${{ matrix.db }},development -Dspring.profiles.active=test,${{ matrix.db }}
run: mvn clean verify -P${{ matrix.db }},${{ matrix.env }} -Dspring.profiles.active=test,${{ matrix.db }}
4 changes: 2 additions & 2 deletions src/main/resources/archetype-resources/pom.xml
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.bernardomg.maven</groupId>
<artifactId>base-pom</artifactId>
<version>1.3.4</version>
<version>1.3.5</version>
</parent>

<!-- ********************************************** -->
Expand Down Expand Up @@ -390,7 +390,7 @@
<!-- ============================================== -->
<!-- ================= MAVEN SITE ================= -->
<!-- ============================================== -->
<site.skin.version>2.0.8</site.skin.version>
<site.skin.version>2.0.10</site.skin.version>
</properties>

<!-- ********************************************** -->
Expand Down
19 changes: 7 additions & 12 deletions src/main/resources/archetype-resources/readme.md
@@ -1,7 +1,7 @@
#set( $symbol_pound = '#' )
${symbol_pound} ${projectName}

This is a [Spring MVC](https://spring.io) project using [React](https://reactjs.org/) templates for the frontend, created with the use of the [Spring MVC with React Maven Archetype](https://github.com/Bernardo-MG/spring-mvc-react-maven-archetype). It will ease the development of new Spring MVC projects, setting it up for CI through the use of three free services: [Github](https://github.com/), [Github Workflow](https://docs.github.com/en/actions/configuring-and-managing-workflows) and [Bintray](https://bintray.com/).
This is a [Spring MVC](https://spring.io) project using [Angular](https://angular.io/) templates for the frontend, created with the use of the [Spring MVC with Angular Maven Archetype](https://github.com/Bernardo-MG/spring-mvc-angular-maven-archetype). It will ease the development of new Spring MVC projects, setting it up for CI through the use of three free services: [Github](https://github.com/), [Github Workflow](https://docs.github.com/en/actions/configuring-and-managing-workflows) and [Bintray](https://bintray.com/).

Before beginning with the new project there are a few things which should be edited:

Expand Down Expand Up @@ -29,7 +29,7 @@ The project by default comes with a useful series of features:
- Preconfigured POM to begin developing a new [Spring MVC](https://spring.io) project with [Spring Boot}(https://spring.io/projects/spring-boot).
- Initial sample project including working persistence and exception handling
- Integration with [Thymeleaf](http://www.thymeleaf.org/) for the view templates.
- Using [React](https://reactjs.org/) for the UI.
- Using [Angular](https://angular.io/) for the UI.
- Using [Liquibase](http://www.liquibase.org/) for database versioning.
- Integration with [iText](https://itextpdf.com/) for generating PDFs.
- Prepared for [Github Workflow](https://docs.github.com/en/actions/configuring-and-managing-workflows), including configuration files and deployment scripts. Check the [Archetype documentation](http://docs.bernardomg.com/maven/library-maven-archetype) to find out more.
Expand All @@ -52,7 +52,7 @@ Documentation is also generated from the latest snapshot, taken from the 'develo
The documentation site is actually a Maven site, and its sources are included in the project. If required it can be generated by using the following Maven command:

```
mvn verify site -P h2,development
mvn verify site -P h2,development -Dspring.profiles.active=test,h2
```

The verify phase is required, otherwise some of the reports won't be generated.
Expand All @@ -61,17 +61,12 @@ ${symbol_pound}${symbol_pound} Usage

The application is coded in Java, using Maven to manage the project.

${symbol_pound}${symbol_pound}${symbol_pound} Prerequisites

The project has been tested on the following Java versions:
* JDK 8

All other dependencies are handled through Maven, and noted in the included POM file.

${symbol_pound}${symbol_pound}${symbol_pound} Profiles

Maven profiles are included for setting up the database.

Spring profiles are also included for the databases. Matching the same name.

| Profile | Database |
|----------|-----------------------|
| h2 | H2 in-memory database |
Expand All @@ -92,7 +87,7 @@ ${symbol_pound}${symbol_pound}${symbol_pound} Running
To run the project locally use the following Maven command:

```
mvn spring-boot:run -P h2,development
mvn spring-boot:run -P h2,development -Dspring.profiles.active=h2
```

It will be accessible at [http://localhost:8080/](http://localhost:8080/).
Expand All @@ -104,7 +99,7 @@ The project requires a database and a server for being able to run the integrati
Just like running the project, an embedded server with an in-memory database can be used:

```
mvn verify -P h2,development
mvn verify -P h2,development -Dspring.profiles.active=test,h2
```

${symbol_pound}${symbol_pound}${symbol_pound} Packaging the WAR
Expand Down
@@ -1,16 +1,53 @@
/**
* The MIT License (MIT)
* <p>
* Copyright (c) ${currentYear} the original author or authors.
* <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* <p>
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package ${package};

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
* Application runnable class. This allows Spring Boot to run the application.
*
* @author Bernardo Mart&iacute;nez Garrido
*
*/
@SpringBootApplication
public class Application {

/**
* Runnable main method.
*
* @param args execution parameters
*/
public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
}

/**
* Default constructor.
*/
public Application() {
super();
}
Expand Down
Expand Up @@ -26,6 +26,8 @@

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.base.MoreObjects;

public class DefaultResponse<T> implements Response<T> {

private T content;
Expand Down Expand Up @@ -67,4 +69,10 @@ public void setStatus(final ResponseStatus value) {
status = value;
}

@Override
public final String toString() {
return MoreObjects.toStringHelper(this).add("status", status)
.add("content", content).toString();
}

}
Expand Up @@ -2,5 +2,5 @@ import { ApiPage } from './api-page';

export interface ApiResponse<T> {
content: ApiPage<T>;
status: T;
status: String;
}
@@ -1,12 +1,12 @@
# ${projectName}

This is a base project created with the [Spring MVC with Thymeleaf Maven Archetype][archetype], prepared to ease the development of new libraries.
This is a base project created with the [Spring MVC with Angular Maven Archetype][archetype], prepared to ease the development of new libraries.

Note that while it is meant to be a working project from the beginning, meaning that it compiles, runs the tests and creates the docs. It is mostly composed of placeholder classes which should be swapped with actual content.

## Where should I start customizing the project?

First of all, check the [Spring MVC with Thymeleaf Maven Archetype][archetype] documentation, and then edit the readme file and the Maven site descriptions about the project.
First of all, check the [Spring MVC with Angular Maven Archetype][archetype] documentation, and then edit the readme file and the Maven site descriptions about the project.

After that, of course, the classes and tests included should be replaced with actual code, which also means adding dependencies and changing profiles and plugins as needed on the POM.

Expand All @@ -20,4 +20,4 @@ While the project can be used just by itself, it won't take full advantage of mo
- Test artifacts repository, Sonatype OSS by default.
- Documentation repository, through SSH by default.

[archetype]: https://www.github.com/bernardo-mg/spring-mvc-react-maven-archetype
[archetype]: https://www.github.com/bernardo-mg/spring-mvc-angular-maven-archetype
Expand Up @@ -7,7 +7,7 @@ The project requires a database and a server. But the included Maven profiles al
To run the project locally with an H2 in-memory database:

```
mvn spring-boot:run -P h2,development
mvn spring-boot:run -P h2,development -Dspring.profiles.active=h2
```

This makes the project be accessible at [http://localhost:8080/](http://localhost:8080/).
Expand Down
4 changes: 2 additions & 2 deletions src/site/markdown/index.md
Expand Up @@ -36,15 +36,15 @@ This configuration is for the database, and the easiest way to handle it is by u
The verify phase is required for generating all the reports, and this means that the integration tests will be run, which require all the dependencies.

```
$ mvn verify site -P h2,development
mvn verify site -P h2,development -Dspring.profiles.active=test,h2
```

### Running the project locally

To run the project locally use the following Maven command:

```
mvn spring-boot:run -P h2,development
mvn spring-boot:run -P h2,development -Dspring.profiles.active=h2
```


Expand Down

0 comments on commit 106691b

Please sign in to comment.