Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions scanner/maven.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package scanner

func configureMaven(sourceDir string, _ *ScannerConfig) (*SourceInfo, error) {
if !checksPass(sourceDir, fileExists("pom.xml")) {
return nil, nil
}

env := map[string]string{
"PORT": "8080",
}

s := &SourceInfo{
Family: "Maven",
Port: 8080,
SkipDatabase: true,
Env: env,
}

s.Files = templates("templates/maven")

return s, nil
}
1 change: 1 addition & 0 deletions scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func Scan(sourceDir string, config *ScannerConfig) (*SourceInfo, error) {
configureNode,
configureStatic,
configureDotnet,
configureMaven,
configureRust,
}

Expand Down
77 changes: 77 additions & 0 deletions scanner/templates/maven/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Compiled class file
**/*.class

# Log file
**/*.log

# BlueJ files
**/*.ctxt

# Mobile Tools for Java (J2ME)
**/.mtj.tmp

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

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

# Maven
**/target
**/pom.xml.tag
**/pom.xml.releaseBackup
**/pom.xml.versionsBackup
**/pom.xml.next
**/release.properties
**/dependency-reduced-pom.xml
**/buildNumber.properties
**/.mvn/timing.properties
**/.mvn/wrapper/maven-wrapper.jar

# Eclipse
**/.apt_generated
**/.classpath
**/.factorypath
**/.project
**/.settings
**/.springBeans
**/.sts4-cache

# IntelliJ IDEA
**/.idea
**/*.iws
**/*.iml
**/*.ipr

# NetBeans
nbproject/private
nbbuild
dist
nbdist
.nb-gradle

# VS Code
**/.vscode

# OS Files
**/.DS_Store
**/.DS_Store?
**/._*
**/.Spotlight-V100
**/.Trashes
**/ehthumbs.db
**/Thumbs.db

# Temporary files
**/*.tmp
**/*.bak
**/*.swp
**/*~.nib

fly.toml
18 changes: 18 additions & 0 deletions scanner/templates/maven/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# BUILD STAGE
#
FROM maven:3.9.11-sapmachine-25 AS build
COPY src /usr/src/app/src
COPY pom.xml /usr/src/app
RUN mvn -f /usr/src/app/pom.xml clean package

#
# PACKAGE STAGE
#
FROM openjdk:26-slim
# COPY --from=build /usr/src/app/target/demo-0.0.1-SNAPSHOT.jar /usr/app/demo-0.0.1-SNAPSHOT.jar
# EXPOSE 8080
# CMD ["java","-jar","/usr/app/demo-0.0.1-SNAPSHOT.jar"]
COPY --from=build /usr/src/app/target/*.jar /usr/app/app.jar
EXPOSE 8080
CMD ["java","-jar","/usr/app/app.jar"]
Loading