Error: Could not find option 'InlineBeforeAnalysis' - spring-native

Anyone knows the error "Error: Could not find option 'InlineBeforeAnalysis'"?? I am getting that error when I try to generate the image using spring-native.
Error: Could not find option 'InlineBeforeAnalysis'. Use -H:PrintFlags= to list all available options.
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1
<profile>
<id>native-image</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
<plugin>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>native-image-maven-plugin</artifactId>
<version>21.0.0</version>
<configuration>
<!-- The native image build needs to know the entry point to your application -->
<mainClass>com.mainpackage.Application</mainClass>
<buildArgs>
--no-fallback -H:+InlineBeforeAnalysis -H:+ReportExceptionStackTraces
</buildArgs>
</configuration>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Thanks very much in advance.

Related

Maven Profiles error with -Dcucumber.options with multiple tags

The following code below is throwing a cannot resolve symbol when trying to create a profile in my pom. I can run this with no issues with one tag, but multiple cannot resolve the issue. I tried --tags #value, #value and --tags #value --tags #value, but they still give the same error.
Can someone help with this error? I am getting cannot resolve symbol 'firstTag'
<profile>
<id>Test</id>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<includes>
<include>**/**/Runner.java</include>
</includes>
<argLine>
-Dcucumber.options="--tags #firstTag, #secondTag"
</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Try
"-Dcucumber.options=--tags '#firstTag and #secondTag'"

Could not lookup required component: java.util.NoSuchElementException

I started testing a Maven plug-in via the maven-invoker-plugin, and am stuck with a weird exception:
[ERROR] Failed to execute goal my.company:plugin:1.0.4-SNAPSHOT:goal on project org.acme.simple: Could not lookup required component: java.util.NoSuchElementException
[ERROR] role: my.company.plugin.SomeClass
I added the maven-invoker-plugin like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>2.0.0</version>
<configuration>
<pomIncludes>
<pomInclude>simple/pom.xml</pomInclude>
</pomIncludes>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<settingsFile>src/it/settings.xml</settingsFile>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
I -erm- borrowed the settings.xml from this Maven plug-in. And what fails in the pom.xml to be tested is this call:
<plugin>
<groupId>my.company</groupId>
<artifactId>plugin</artifactId>
<version>#project.version#</version>
</plugin>
After some more digging around, I figure that Tycho is at least part of the problem:
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>0.22.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
If I remove #project.version# it works, but it's evidently not the current version of the plug-in that is tested. So I guess I have to leave it in. I tried adding maven-compat (as suggested here), but it didn't do anything.
The same exception is displayed when I don't add the plug-in in the pom.xml, but call it via:
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:goal
Any advice how to handle that problem?
Evidently this plug-in got lost somehow, adding it again made the exception go away:
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>1.5.5</version>
<executions>
<execution>
<goals>
<goal>generate-metadata</goal>
<goal>generate-test-metadata</goal>
</goals>
</execution>
</executions>
</plugin>

maven not reading defined properties

Don't know why it is not working. I have a couple of defined properties on the POM and I'm running a little script from it which should be able to read these properties, but it's not happening.
This is the POM:
<properties>
<propery.one>SOMETHING</propery.one>
<propery.two>SOMETHING</propery.two>
<commandline.location>/SOME/PATH/</commandline.location>
<commandline.executable>commandline-script.sh</commandline.executable>
......
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>export</id>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${commandline.executable}</executable>
<workingDirectory>${commandline.location}</workingDirectory>
<arguments>
<argument>${project.basedir}/scripts/myScript.sh</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I'm calling Maven with this command: mvn deploy (which I suppose. it's the correct one)
So, once it starts, I can see a lot of exceptions because the script called on this line: "${commandline.executable}" is not reading the properties from the POM.
Help please...

Generating java from rpc wsdl

I have a pom which generates some java code from an RPC wsdl. The problem is that the code is never generated.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<sourceDirectory>src/main/resources</sourceDirectory>
<outputDirectory>${project.build.directory}/generated/rpc</outputDirectory>
<packageSpace>com.company.wsdl</packageSpace>
<testCases>false</testCases>
<serverSide>true</serverSide>
<subPackageByFileName>false</subPackageByFileName>
</configuration>
<executions>
<execution>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
Any ideas as to why this isnt generating the java code?
After taken a look into your pom I realized your problem. It's not related to calling mvn its based on the configuration you made.
You have configured the axistools-maven-plugin in the pluginManagement area. In this case you need to do this in the build area like this:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
..
</configuration>
<executions>
<execution>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
...
</build>
instead of:
<build>
<pluginManagement>
<plugins>
...
</plugins>
</pluginManagement>
...
</build>
If you configure it correctly you can use mvn clean package or mvn clean install instead of calling mvn axistools:wsdl2java ...

Is it possible to execute two different maven exec-maven-plugin in a single POM

I execute the following code using mvn exec:java com.mycompany.FooServer.
I would like to add another server which I can execute like mvn exec:java com.mycompany.BarServer.
How do I do that within a single pom file?
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.mycompany.FooServer</mainClass>
</configuration>
</plugin>
</build>
Try this. You can have more than one execution under executions. All you need to do is move the configuration element under the execution. The plugin has configuration, but each execution can also have a separate configuration element.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>first-execution</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.mycompany.FooServer</mainClass>
</configuration>
</execution>
<execution>
<id>second-execution</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.mycompany.BarServer</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
With Maven 3.3.1 and up, you can run an execution by its ID using
mvn exec:java#id
In this case the commands would be mvn exec:java#first-execution and mvn exec:java#second-execution. See this answer for more details.
#tieTYT: You can select the execution by id using two distinct profiles:
mvn test -Pmanager
mvn test -Pproxy
<profiles>
<profile>
<id>proxy</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>pt.inesc.proxy.Proxy</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>manager</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>pt.inesc.manager.Manager</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
With maven > 3.3.1 it is possible to specify the execution id as:
mvn exec:java#execId
For me including configuration in the execution block didn't work and maven complained about main class not being set. But inspired by Dario's answer I'd answer this question as follows:
<profiles>
<profile>
<id>foo</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<mainClass>com.mycompany.FooServer</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>bar</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<mainClass>com.mycompany.BarServer</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Which then allows you to run one or the other server using:
mvn exec:java -Pfoo
or
mvn exec:java -Pbar
Cheers,
I find the solution: I put <configuration> in <execution>
you can use mvn clean test -Pfoo,bar
<profiles>
<profile>
<id>foo</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<id>CountContinusIntegr-execution</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.mycompany.FooServer</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>bar</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<id>CountContinusIntegr-execution</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.mycompany.BarServer</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
I'm afraid that what you want is not possible. I could not find a way to call the same exec-maven-plugin goal directly (mvn exec:java) with different configurations in .pom file.
Said that, you can however have multiple executions of exec-maven-plugin. The thing is you can not call the goals directly. You have to use multiple executions and bind them to particular build phases.
You could also make use of the following solution that fitted me. You can still call one goal directly with it's configuration in the .pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<id>Acceptance Tests</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>pybot</executable>
<arguments>
<!--...-->
</arguments>
</configuration>
</execution>
</executions>
<configuration>
<mainClass>pt.jandias.someapp.persistence.SchemaGenerator</mainClass>
<arguments>
<!--...-->
</arguments>
</configuration>
</plugin>
One could than use mvn exec:java and mvn integration-test at will.

Resources