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

[Java] Compact Profile 2 Check needed ? #214

Closed
svilenvul opened this issue Nov 16, 2017 · 3 comments
Closed

[Java] Compact Profile 2 Check needed ? #214

svilenvul opened this issue Nov 16, 2017 · 3 comments

Comments

@svilenvul
Copy link
Contributor

svilenvul commented Nov 16, 2017

According to the ESH Coding Guidelines - all bundles should be restricted to Java 8 SE Compact Profile 2. I couldn't find settings for profile in the ESH Maven build now.

I am not sure if we need check for that. Maybe if the compilation is done using the correct profile, this should be enough?

On the other hand there are tools as jdeps that can be used to check already compiled jars (dependencies) for compliance with a Compact Profile.

@kaikreuzer, could you share your thoughts about this topic?

@svilenvul
Copy link
Contributor Author

I have tried the following configuration on the maven-compiler-plugin

<compilerArgs>
    <arg>-profile compact2</arg>
</compilerArgs>

I am not sure if this argument is supported only on Java SE Embedded, the build is failing with compilation failure without much information, what went wrong:

[INFO] --- maven-compiler-plugin:3.6.1:compile (default) @ org.eclipse.smarthome.core.autoupdate ---
[INFO] Changes detected - recompiling the module!
[INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files
[INFO] Found 0 errors and 0 warnings.

......


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default) on project org.eclipse.smarthome.core.autoupdate: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default) on project org.eclipse.smarthome.core.autoupdate: Compilation failure
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1033)
	at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:137)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more

Strange is that I don`t see any groovy files in this bundle...

@svilenvul
Copy link
Contributor Author

OK, just an example, how this could be made with jdeps: https://github.com/eclipse/kura/blob/a4909801fe5fdb49788485a40383534599d6a0ff/kura/pom.xml#L542

@kaikreuzer, do you think it is worth to put some efforts into that.

@kaikreuzer
Copy link
Member

Hi @svilenvul! Sorry, I had missed your earlier question from November 😟
Yes, such a check would be great! And if it is easy to take over from Kura without having to figure out the details on our own, even better!

@svilenvul svilenvul self-assigned this Mar 9, 2018
svilenvul pushed a commit to MusalaSoft/static-code-analysis that referenced this issue Mar 30, 2018
Closes openhab#214

Signed-off-by: Svilen Valkanov <svilen.valkanov@musala.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants