Skip to content

Commit

Permalink
Add example project, fix path
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>
  • Loading branch information
jmle committed Apr 30, 2024
1 parent d03f333 commit 9adae2b
Show file tree
Hide file tree
Showing 24 changed files with 1,218 additions and 266 deletions.
610 changes: 348 additions & 262 deletions demo-dep-output.yaml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions demo-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@
description: ""
category: potential
incidents:
- uri: file:///examples/gradle-multi-project-example/build.gradle
message: dependency junit.junit with 4.12 is bad and you should feel bad for using it
variables:
name: junit.junit
version: "4.12"
- uri: file:///examples/java/pom.xml
message: dependency io.fabric8.kubernetes-client with 6.0.0 is bad and you should feel bad for using it
variables:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
### Intellij+iml ###
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij+iml Patch ###
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

.idea/

*.iml
modules.xml
.idea/misc.xml
*.ipr

### Java ###
# Compiled class file
*.class

# Log file
*.log

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Gradle ###
.gradle
**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) [year] [author]

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:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
web: java -jar build/libs/template-server-all.jar
worker: java -jar build/libs/template-core-all.jar
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# gradle-multi-project-example

Basic gradle template with subprojects, deployable to Heroku as separate dyno processes.

## What's included?

1. Gradle Plugins
- application plugin
- shadowjar plugin
2. Code Style
- checkstyle
- findbugs
- pmd
3. General Libraries
- guava
- junit
- mockito
- log4j2 via slf4j
4. Multi-Project Gradle Setup
- see: [settings.gradle](settings.gradle)
5. Heroku Deployment
- see: [Procfile](Procfile), [stage.gradle](gradle/heroku/stage.gradle)

## Development

### Building

```
$ ./gradlew clean build
```

### Testing

```
$ ./gradlew clean test
```

### Building Deployment Artifacts

```
$ ./gradlew clean stage
```

### Running

Use the Gradle [application plugin](https://docs.gradle.org/current/userguide/application_plugin.html).
However, `./gradlew run` will run applications in lexicographical order.
Instead, explicitly specify which subproject to run:

```
$ ./gradlew template-core:run
$ ./gradlew template-server:run
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apply plugin: 'idea'

ext {
log4jVersion = '2.9.1'
}

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
}
}

allprojects {
repositories {
mavenLocal()
mavenCentral() // maven { url: 'http://jcenter.bintray.com' }
}
}

apply from: file('gradle/check.gradle')
apply from: file('gradle/heroku/clean.gradle')

subprojects {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'

group = "io.jeffchao.${rootProject.name}"

dependencies {
implementation 'com.google.guava:guava:23.0'

testImplementation 'junit:junit:4.12'

compile "org.apache.logging.log4j:log4j-api:$log4jVersion"
compile "org.apache.logging.log4j:log4j-core:$log4jVersion"
compile "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"

testCompile 'org.mockito:mockito-core:2.11.0'

}

apply from: file("$rootProject.projectDir/gradle/heroku/stage.gradle")

}
Loading

0 comments on commit 9adae2b

Please sign in to comment.