I'm using GAE, I usually do Deploy with a plugin for eclipse where it gives me the option to send it a version to upload, however I want to do it by command line, the command is as follows
mvn appengine:deploy
However I want to set the "version" parameter, but I do not know how.
To solve it I added the following plugin in the pom:
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>2.0.9.120.v20160803</version>
<configuration>
<gcloud_directory>/usr/lib/google-cloud-sdk</gcloud_directory>
</configuration>
</plugin>
And I executed the following command:
mvn gcloud:deploy -Dgcloud.version=VERSION
Related
I am new to Liquibase. I have already included maven plugins and liquibase to my pom.xml however when i update liquibase using mvn liquibase:update I get this error:
No plugin found for prefix 'liquibase' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo]
How can I fix this error so that when I type mvn liquibase:update it will run properly
Here are some of the dependencies that are in my pom.xml related to liquibase
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.6.3</version>
<configuration>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
</plugin>
</build>
I don't think the problem is with liquibase plugin itself. It's more about maven prefixes.
Try executing: mvn org.liquibase:liquibase-maven-plugin:update
Also, check out this question.
Make sure you are in the right path when you are executing mvn liquibase:update command. And also try to run the command in a separate terminal like command prompt. In my case I'm using the terminal in IntelliJ IDEA when I had the problem but when I tried it in different terminal, it worked flawlessly.
In my case problem was in path. I was trying to start command c:\mvn.cmd liquibase:status from wrong folder.
Running from c:\projects\My_current_project\mvn liquibase:status works like a charm. c:\projects\My_current_project\ is folder, where pom.xml is.
In my case the issue was my pom is configured in such a way that the liquibase plugin is only defined under certain profiles which need to be passed in before the mvn liquibase:<your command here> gets run.
for example, if the pom.xml has a local profile and your liquibase plugin is ONLY defined under that profile, you should run something like mvn -P local liquibase:update in order for maven to pick up liquibase (since it's only defined in that profile)
I have a project with finalised version in pom files , lets say 12.3.45 .
I have built the code for this version some time ago already, all the built jars are in the local maven repo.
Then at some point I have run mvn clean, so all the target folders are being removed.
And now I want to execute some code, as quickly as possible, using mvn exec:java. Preferably without building anything, because why not? all the jars at some point were already built, and I know there were no code changes after that. How can I force maven to execute the code as fast as possible , not recompile anything, and just reuse the jars from the local repo?
Thanks.
If your artifacts are in a local or remote repository you can use them as dependencies.
You can use exec-maven-plugin's options includeProjectDependencies or includePluginDependencies to use them in java execution
https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#includePluginDependencies. includeProjectDependencies option is enabled (true) by default.
You can execute exec-maven-plugin without building anything with mvn exec:java command
Instructions:
To run exec-maven-plugin you would need a main class to run. I assume you have one in your project. If you don't - you need to make a separate project with a main class.
Create a blank maven project.
In the project add exec-maven-plugin configuration. Set the mainClass
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>pack.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
Include you artifacts as dependencies to the project
<dependencies>
<dependency>
<groupId>my.group</groupId>
<artifactId>myartifact</artifactId>
<version>12.3.45</version>
</dependency>
</dependencies>
Run mvn exec:java to execute com.my.package.MyMainClass main class from my.group.myartifact artifact
Edits:
includeProjectDependencies option is enabled (true) by default
I´m trying to build an executable jar with spring boot. It seems like that the jvmArguments that I've configured in the spring-boot-maven-plugin are not interpreted when running the jar on the server.
Here is the part of my pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
<jvmArguments>-Xmx256m</jvmArguments>
</configuration>
</plugin>
</plugins>
</build>
I am building the application with:
mvn clean package
This is how i start my application:
[tomcat#dps-8 klstest]$ ./klsprovider-1.1.0.jar --spring.config.name=application-prod
And this is where I'm hoping to see the jvmArguments:
[tomcat#dps-8 ~]$ jps -lvm | grep 33806
33806 /tmp/klstest/klsprovider-1.1.0.jar --spring.config.name=application-prod -Dsun.misc.URLClassPath.disableJarChecking=true
[tomcat#dps-8 ~]$
Why are the parameters not recognized/interpreted?
Spring Boot executable JAR is build with repackage goal which doesn't support jvmArguments option. This option is recognized by run goal, which will start the application locally during development.
spring-boot-maven-plugin run phase is intended to run your application locally within a Maven process or a Maven forked process depending on configuration. Mainly for test or debugging purpose.
If you have built jar spring-boot-maven-plugin run phase is not applied at all. You need to specify parameters separately for your prod system.
I wrote a maven code in netbeans that in included 6 classes:
ColumnComparator.java
IQC.java
Main.java
MultipleLinearRegression.java
Overlap.java
PSResidualReduction.java
I want to compile and run it on linux terminal. I tried:
javac Main.java ColumnComparator.java IQC.java MultipleLinearRegression.java Overlap.java PSResidualReduction.java
and got compilation error. The problem is that in MultipleLinearRegression class, I used jama package to do Matrix computation, but in command line I do not know how I should modify dependencies. Hopefully you guys can help me.
Just use the exec-maven-plugin.
Add these lines to your pom.xml (you might already have the <build/> and <plugins/> tag there). Make sure to set the <mainClass/> tag to point to your specific main class.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>com.example.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
Then you run your program from command line:
mvn exec:java
This will not affect/change the behavior of your Netbeans setup so you will still be able to run the program from within Netbeans.
Currently we are working on the big maven project that has about 100 modules, some of them have submodules as well.
Some of modules use Maven Build Number plugin. The project is hosted under subversion.
Recently we started to use git locally in our development team.
After cloning subversion repo and trying to build the Project, we received following well known error:
The svn command failed.
Command output:
svn: ‘.’ is not a working copy
Unfortunately in our case it is not an option to create a new profile or just remove plugin definition from POM (this will follow to messing up hundreds of POM files).
I found the following article http://abstractionextraction.wordpress.com/2012/09/27/git-svn-vs-maven-build-number-plugin/ but honestly, it's not something that I would really like to do...
Is there any smart way to disable this plugin. Like command-line parameter?
I think you may skip failure on obtain revision without change project pom.xml - buildnumber-maven-plugin has option revisionOnScmFailure which you may use like:
mvn -Dmaven.buildNumber.revisionOnScmFailure=no-scm package
In that case value no-scm will be used if scm call was unsuccessful. Off course you may change it and provide any other string.
Per the mojo documentation, you could use the revisionOnScmFailure property.
However, it doesn't have a command line option. You'll have to modify those pom.xml files.
See "Defining Parameters Within a Mojo" in the Maven Java Plugin Development Guide
One approach would be to use a property in your pom to specify the execution phase of the build number plugin, as shown below.
<project>
..
<properties>
<buildnumber.plugin.phase>validate</buildnumber.plugin.phase>
..
</properties>
..
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<phase>${buildnumber.plugin.phase}</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
..
</configuration>
</plugin>
</plugins>
..
</project>
Then provide the property on the command line to disable the plugin, as shown in the following example.
mvn install -Dbuildnumber.plugin.phase=none