We want to generate a new project to test few things on specific release for e.g; 16.11.2 (Kiwi release)
What -additional params that is required to pass with the given command
mvn -U org.seedstack:seedstack-maven-plugin:generate
Regards
Indrajit
You can generate a project for a specific version by manually specifying the archetype version (which always matches the SeedStack version).
For SeedStack 16.11.2:
mvn -U org.seedstack:seedstack-maven-plugin:generate -DarchetypeVersion=16.11.2
See the related documentation for additional parameters and information.
Related
I have setup a Nexus repository to store our built artifacts, third party dependencies, and home brewed shared source code headers.
I am currently using wget to retrieve the third party dependencies and shared source headers for use while building our software applications (the source for the specific applications are stored in separate git repositories).
When you use wget, you essentially have to know the exact version of the artifact that you want - you must explicitly know what the latest version number is.
Is there another way to retrieve the latest version of an artifact from the maven releases nexus repository without actually knowing what the version number is?
It would be ideal if there was a way to do this using wget instead of maven itself because I don't want to force users to install apache maven just for the purpose of downloading artifacts from nexus.
I think you cannot do it by using curl only. You will need to accomplish other tasks to achieve what you want.
Here is a possibility:
You should first access to maven repository metadata file. (You will find the documentation here: http://maven.apache.org/ref/3-LATEST/maven-repository-metadata/repository-metadata.html)
For instance, let's say that you want to download the latest version of the following maven artifact from maven central:
groupId = javax
artifactId = javaee-api
Download the following file:
http://central.maven.org/maven2/javax/javaee-api/maven-metadata.xml
Its contents will be something like:
<metadata>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<versioning>
<latest>8.0</latest>
<release>8.0</release>
<versions>
<version>7.0</version>
<version>8.0</version>
</versions>
<lastUpdated>20170915063942</lastUpdated>
</versioning>
</metadata>
Then you will need to access the latest tag to retrieve the latest version.
Documentation says the following regarding the meaning of the latest or release tag:
latest String What the latest version in the directory is, including snapshots
release String What the latest version in the directory is, of the releases only
You should find this file also in nexus repositories, and you should use something like xmllint to obtain the value you want. For instance:
curl http://central.maven.org/maven2/jx/javaee-api/maven-metadata.xml \
| xmllint --xpath "/metadata/versioning/latest/text()" -
or
curl http://central.maven.org/maven2/jx/javaee-api/maven-metadata.xml \
| xmllint --xpath "/metadata/versioning/release/text()" -
depending on what you want exactly.
After that, you can use the version information to compose the full URL of the artifact you want to download.
Hope this helps.
Cheers.
Edu.
I have a Maven project which has many a set of customer-specific modules of which one is used. The command to execute this build is as follows:
mvn clean install --projects [targetModule] --also-make
Normally I would use profiles to configure module selection and it appears that the end result is similar in this case. I cannot seem to find any documentation on this --projects flag and its semantics which is making me hesitant to specific a different set of modules. Does anyone know how --projects and/or --also-make works or where I might find documentation on them?
mvn --help gives some information regarding this.
-am,--also-make If project list is specified, also
build projects required by the
list
-pl,--projects <arg> Build specified reactor projects
instead of all projects
First of all, I do have some sort of understanding that the following might not be the generally accepted way to do things.
We have a Maven 2 project that has a version number which should be updated each week or so, during a new release. During this process, I've tried to eliminate all the things one has to remember and I've made a bash script that handles the process interactively.
However, my problem is updating the pom version from the command line. I can do this with sed but I don't think it is very convenient. I was wondering if there is any maven plugin that would be able to modify the pom.xml directly from the command line. The version is set in the properties section of the pom. Would it be possible to write a plugin that would change the properties?
Thanks in advance.
Update
It seems that my issue was with project versions defined as properties (that were applied when filtering) which seems now a bit dumb.
One thing that I'm still looking for an answer is how to get the version of certain project reliably to the command line. Previously I had a "pretty unique" property that I got using grep, but now the <version> element is not unique as in child project there is at least two of these. I would need some sort of XML parser if Maven has no solutions, but my goal is to make the script as independent as possible.
I'm not sure if I should've created a new question from this, but I didn't. Getting the version is very closely related to the setting the version.
I was wondering if there is any maven plugin that would be able to modify the pom.xml directly from the command line.
The Versions Maven Plugin can do this. Check the following goal:
versions:set can be used to set the project version from the command line, updating the details of any child modules as necessary.
From Maven POM reference:
env.X: Prefixing a variable with
"env." will return the shell's
environment variable. For example,
${env.PATH} contains the PATH
environment variable. Note: While
environment variables themselves are
case-insensitive on Windows, lookup of
properties is case-sensitive. In other
words, while the Windows shell returns
the same value for %PATH% and %Path%,
Maven distinguishes between
${env.PATH} and ${env.Path}. As of
Maven 2.1.0, the names of environment
variables are normalized to all
upper-case for the sake of
reliability.
That means that you can have an environment variable like $MYMAVENPROJECTVERSION and read it as this:
<version>${env.MYMAVENPROJECTVERSION}</version>
You can update this environment variable every week, before running build.
Hope this will help you.
I'm using PMEase QuickBuild to perform automated builds of our Maven2 projects and a nightly sanity test to ensure nothing is broken.
The test needs to untar packages which are created by the automated Maven2 projects. The problem is that the package names change frequently due to project versions being incremented all the time.
Does anyone know how I can configure QuickBuild to pick up the version (ideally from the POM file of the individual components), if this is possible at all?
I don't know if this is an option for you but it looks like you can do it the other way around. Quoting Build with Maven:
Control build version
If you want to control the build
version from QuickBuild side, please
follow below steps:
Change the POM file and define the project version as
${buildVersion}. Do not forget to
commit the file into your SCM after
change.
Define a build property like below when define the Maven build
step:
buildVersion=${build.version}
There are maybe other options but I must admit that my knowledge (zero) of QuickBuild is very limited
I created a work around to this issue by having QuickBuild execute a shell script which did the untarring by using wildcards, similar to the following (to avoid computing the exact version):
tar xzf filename-*.tar.gz
I couldn't figure out how to do this in QuickBuild, so I offloaded the work to the shell script.
I have a library that I distribute using maven 2. The typical user of this library doesn't use maven to build their applications, but is likely somewhat familiar with maven and probably has it installed.
I'd like to document a "simple" one line command they can use to download my library's artifacts to their local ~/.m2/repository without requiring that they set up a pom.xml to do it.
I thought there was a way to do this, but I can't seem to find it after looking through the install:install-file and dependency plugin documentation. I tried things like:
mvn install:install-file -DrepositoryId=java.net -Durl=http://download.java.net/maven/2/ -Dfile=robo-guice-0.4-20091121.174618-1.jar -DpomFile=robo-guice-0.4-20091121.174618-1.pom -DgroupId=robo-guice -DartifactId=robo-guice -Dversion=0.4-SNAPSHOT -Dpackaging=jar
but I think I'm barking up the wrong tree since it appears that the install plugin is used to copy locally built files into the local repository, rather than download remote artifacts into the local repository.
This is the artifact I'd like to install: http://download.java.net/maven/2/robo-guice/robo-guice/0.4-SNAPSHOT/
Is this possible using maven?
Since version 2.1 of the Maven Dependency Plugin, there is a dependency:get goal for this purpose. To make sure you are using the right version of the plugin, you'll need to use the "fully qualified name":
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \
-DrepoUrl=http://download.java.net/maven/2/ \
-Dartifact=robo-guice:robo-guice:0.4-SNAPSHOT
Give them a trivial pom with these jars listed as dependencies and instructions to run:
mvn dependency:go-offline
This will pull the dependencies to the local repo.
A more direct solution is dependency:get, but it's a lot of arguments to type:
mvn dependency:get -DrepoUrl=something -Dartifact=group:artifact:version
As of version 2.4 of the Maven Dependency Plugin, you can also define a target destination for the artifact by using the -Ddest flag. It should point to a filename (not a directory) for the destination artifact. See the parameter page for additional parameters that can be used
mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get \
-DremoteRepositories=http://download.java.net/maven/2 \
-Dartifact=robo-guice:robo-guice:0.4-SNAPSHOT \
-Ddest=c:\temp\robo-guice.jar