Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

platform build does not work with Java templates out of the box #1157

Open
thewheat opened this issue Sep 16, 2022 · 0 comments
Open

platform build does not work with Java templates out of the box #1157

thewheat opened this issue Sep 16, 2022 · 0 comments

Comments

@thewheat
Copy link

Trying some of the Java templates https://docs.platform.sh/languages/java.html they do not work

Example template used below is https://github.com/platformsh-templates/spring-boot-maven-mysql

Simplest workaround identified

  • Run platform build
    • Use defaults but specify public for the "Build destination"
    • It will fail the first time but subsequent running of platform build with the default values will succeed
  • Alternatively ln -s . public in the root directory and platform build with the defaults will succeed

Output for the problem

➜  spring-boot-maven-mysql git:(master) platform build
Source directory (default: .): 
Build destination (default: _www): 
Building application app (runtime type: java:11)
Running post-build hooks
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.091 s
[INFO] Finished at: 2022-09-16T16:22:05+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/t/src/javat/spring-boot-maven-mysql/.platform/local/builds/default-tmp). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR] 
[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] 
[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/MissingProjectException
The hook failed with the exit code: 1

Build complete for application app
Web root: /home/t/src/javat/spring-boot-maven-mysql/_www

Cleaning up...

Example of workaround

  • Step 1: Specify public as build destination - first run with this setting will fail
platform build
Source directory (default: .):     
Build destination (default: _www): public
Building application app (runtime type: java:11)
Running post-build hooks
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.100 s
[INFO] Finished at: 2022-09-16T16:23:24+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/t/src/javat/spring-boot-maven-mysql/.platform/local/builds/default-tmp). Plea
se verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR] 
[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] 
[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/MissingProjectException
The hook failed with the exit code: 1
Backing up previous build to: /home/t/src/javat/spring-boot-maven-mysql/.platform/local/builds/default-old.tar.gz

Build complete for application app
Web root: /home/t/src/javat/spring-boot-maven-mysql/public

Cleaning up...
  • Step 2: Retry platform build with the defaults and this should work
➜  spring-boot-maven-mysql git:(master) ✗ ls -l
total 40
-rw-rw-r-- 1 t t 1713 Sep 16 16:01 pom.xml
lrwxrwxrwx 1 t t    1 Sep 16 16:23 public -> .
-rw-rw-r-- 1 t t 2292 Sep 16 16:01 README.md
drwxrwxr-x 4 t t 4096 Sep 16 16:01 src
drwxrwxr-x 5 t t 4096 Sep 16 16:26 target
lrwxrwxrwx 1 t t    1 Sep 16 16:22 _www -> .
➜  spring-boot-maven-mysql git:(master) ✗ platform build
Source directory (default: .): 
Build destination (default: _www): 
The destination exists: /home/t/src/javat/spring-boot-maven-mysql/_www. Overwrite? [Y/n] 
Building application app (runtime type: java:11)
Running post-build hooks
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] -------< sh.platform.template:template-spring-boot-maven-mysql >--------
[INFO] Building template-spring-boot-maven-mysql 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ template-spring-boot-maven-mysql ---
[INFO] Deleting /home/t/src/javat/spring-boot-maven-mysql/target
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ template-spring-boot-maven-mysql ---
[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 0 resource
[INFO] The encoding used to copy filtered properties files have not been set. This means that the same encoding will be used to copy filtered properties files as when copying other filtered resources. This might not be what you want! Run your build with --debug to see which files might be affected. Read more at https://maven.apache.org/plugins/maven-resources-plugin/examples/filtering-properties-files.html
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ template-spring-boot-maven-mysql ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to /home/t/src/javat/spring-boot-maven-mysql/target/classes
...
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant