Okta Spring Boot - compile error


I am attempting to build your okta java spring app using the following cmd (from github sample doc),

xyz:~/environment/samples-java-spring/custom-login (master) $ mvn -Dokta.oauth2.issuer=https://dev-xyz.okta.com/oauth2/default -Dokta.oauth2.clientId=xyz -Dokta.oauth2.clientSecret=xyz
[INFO] Scanning for projects...
[WARNING] Some problems were encountered while building the effective model for com.example.okta:okta-spring-boot-oauth-code-flow-custom-login-example:jar:0.0.1-SNAPSHOT
[WARNING] 'parent.relativePath' of POM com.example.okta:okta-spring-boot-oauth-code-flow-custom-login-example:0.0.1-SNAPSHOT (/home/ec2-user/environment/samples-java-spring/custom-login/pom.xml) points at com.okta.examples:aggregator instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure @ line 20, column 13
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[INFO] ------------------------------------------------------------------------
[INFO] Building Okta :: Samples :: Spring Boot :: Code Flow + Custom Login Page 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] >>> spring-boot-maven-plugin:2.5.2:run (default-cli) > test-compile @ okta-spring-boot-oauth-code-flow-custom-login-example >>>
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ okta-spring-boot-oauth-code-flow-custom-login-example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 7 resources
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ okta-spring-boot-oauth-code-flow-custom-login-example ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /home/ec2-user/environment/samples-java-spring/custom-login/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.060 s
[INFO] Finished at: 2021-11-02T18:55:48Z
[INFO] Final Memory: 18M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project okta-spring-boot-oauth-code-flow-custom-login-example: Fatal error compiling: invalid flag: -parameters -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
bosox23:~/environment/samples-java-spring/custom-login (master) $ 

Param error(s) on cmd line (xyz is just for this post so that’s not RC). POM or source need updates to handle these cmd line params? User error? NOTE: I have to install maven on local dev box (step missing from sample).

See this in local POM,

 18     <modelVersion>4.0.0</modelVersion>
 20     <parent>
 21         <groupId>org.springframework.boot</groupId>
 22         <artifactId>spring-boot-starter-parent</artifactId>
 23         <version>2.5.2</version>
 24     </parent>
 26     <groupId>com.example.okta</groupId>
 27     <artifactId>okta-spring-boot-oauth-code-flow-custom-login-example</artifactId>
 28     <version>0.0.1-SNAPSHOT</version>
 29     <packaging>jar</packaging>
 31     <name>Okta :: Samples :: Spring Boot :: Code Flow + Custom Login Page</name>
 32     <description>Okta OAuth 2.0 w/ Spring Boot Example + Custom Login Page</description>
 34     <properties>
 35         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 36         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 37         <java.version>1.8</java.version>

Thank you.

Hey there! I assume you are referring to the following? GitHub - okta-samples/okta-spring-boot-sample: Spring Boot + Okta

Yes that is correct …

Interesting, I am not able to reproduce the error on my end. Do you see the same issue when you configure and build this sample? You’re looking for a custom self-hosted login implementation rather than okta-hosted (redirect to okta), correct?

You can safely ignore the warning, that Spring Boot parent pom would be downloaded from Maven Central.

The compile error looks real, but I’m guessing that has more to do with the version of Java you are using.

Which version are you using? I quickly just tried (without issue):


Anything Java 8+ should work.

Keep us posted!