Parameterized version like Spring Boot - maven

I want to parameterize Maven version as a variable like Spring Boot.
Every submodule use version as <version>${revision}</version>.
#see git#github.com:iPhotoner/parameterized-version-demo.git
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>demo-ri</artifactId>
<version>1.0.0</version>
<parent>
<groupId>com.demo</groupId>
<artifactId>demo-parent</artifactId>
<version>parameterized.version</version>
<relativePath />
</parent>
<properties>
<demo.version>parameterized.version</demo.version>
</properties>
<dependencies>
<dependency>
<groupId>com.demo</groupId>
<artifactId>demo-api</artifactId>
<version>${demo.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>nexus</id>
<name>maven-public</name>
<url>http://192.168.1.1:8089/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>

thanks,#khmarbaise,
i give up using maven-ci-friendly at present,maybe ${revision} something wrong with ${revision} under spring boot,and some version i can not hold it;
first,i created a module extends parent:
Not Covered
second:flatten plugin occurs on eclipse 4.7.3a java standard version;
Can Not Load Flatten
three:use flatten plugin inherited:true or false, and starter-* open,
project works fine,junit five and restdoc can extend from starter module,
if do not use flatten,also works fine:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<!-- <inherited>true or false</inherited> -->
<configuration>
<updatePomFile>true</updatePomFile>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
Extend
step four:if i execute mvn clean deploy upload jar to nexus,and close
starter module,errors on project cif-dependency,this project
has no relation with starter module(just extends from it),
and junit five/restdocs can not be extends from starter module,
Not Extend

Related

Maven NullPointer Exceptions

I am integrating Soapui with jenkins using soapui version 5.3.0.
I am using correct plugins, and created a job on Jenkins, when running job on jenkins getting below error
ERROR: Processing failed due to a bug in the code. Please report this to the issue tracker (https://jenkins.io/redirect/report-an-issue).
java.lang.NullPointerException
project=hudson.maven.MavenModuleSet#1844c02b[Integration-/Feature/Dev/API/Testing1]
project.getModules()=[hudson.maven.MavenModule#2e2290bb[Integration-/Feature/Dev/API /Testing1/Test:gorun-Beakon][Integration-/Feature/Dev/API/Testing1/Test:gorun][relativePath:], hudson.maven.MavenModule#427c50e9[Integration-/Feature/Dev/API/Testing1/Test:Test][Integration-/Feature/Dev/API/Testing1/Test:Test][relativePath:], hudson.maven.MavenModule#73de5944[relativePath:], hudson.maven.MavenModule#1c7bb084[Integration-/Feature/Dev/API/Testing1/com.smartbear.soapui:soapui-project][Integration-/Feature/Dev/API/Testing1/com.smartbear.soapui:soapui-project][relativePath:], hudson.maven.MavenModule#71ee9349[Integration-/Feature/Dev/API/Testing1/tdrury:com.example.soapuitests][Integration-/Feature/Dev/API/Testing1/tdrury:com.example.soapuitests][relativePath:]]
project.getRootModule()=hudson.maven.MavenModule#2e2290bb[Integration-/Feature/Dev/API/Testing1/Test:gorun][Integration-/Feature/Dev/API/Testing1/Test:gorun][relativePath:]
FATAL: null
java.lang.NullPointerException
Posting build status of FAILED to SWC Bitbucket for commit id [30fd540296aa2f090025d21cf11eef35e13e9f5d] and ref 'refs/heads/master'
Failed to post build status, additional information: timeout
Finished: FAILURE
here is my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.smartbear.samples</groupId>
<artifactId>soapui-maven2-plugin</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-pro-maven-plugin</artifactId>
<version>5.3.0</version>
<dependencies>
</dependencies>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFile>gorun.xml</projectFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I am tried changing my pom and other properties but not sure why i am hitting this error.
This issue was coming because few dependencies were missing and maven was not complaining explicitly. So when run as normal maven project, got all missing dependencies and added them resolved this issue.
Thanks!!!

How to configure Android Studio to include configuration folder containing pom.xml in project?

I am trying to setup a TeamCity "project configuration as code" using Kotlin DSL https://blog.jetbrains.com/teamcity/2019/03/configuration-as-code-part-1-getting-started-with-kotlin-dsl/
I've created a sample project in TeamCity pointing to just an empty Android Studio project with empty Activity which I 've published in the Github. I've enabled Kotlin DSL configuration in the TeamCity GUI for that project.
After that TeamCity has commited a .teamcity folder to my Android Studio project via Git containing pom.xml. This folder is a top project folder and resides in the root along with the app module. However, when I am inspecting the code in settings.kts the IDE is not giving me any hints. I cannot use the autocompletion for the Kotlin DSL configuration code, I don't have any special formatting or code time lint checks in my IDE
I was trying to follow the above mentioned blog guidance but unfortunately I cannot right-click on the pom.xml file and don't see any option to Add as Mavenin Android Studio.
In addition I cannot see any External Libraries being added to my project related to TeamCity DSL which of course means that the dependencies from pom.xml file were not handled.
I am using Android Studio 4.0
This is a pom.xml which TeamCity added to my Android Studio project (under .teamcity folder):
<?xml version="1.0"?>
<project>
<modelVersion>4.0.0</modelVersion>
<name>KotlinTeamcityDSL Config DSL Script</name>
<groupId>KotlinTeamcityDSL</groupId>
<artifactId>KotlinTeamcityDSL_dsl</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<repositories>
<repository>
<id>jetbrains-all</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>teamcity-server</id>
<url>http://localhost:8111/app/dsl-plugins-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>JetBrains</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>${basedir}</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<configuration/>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>process-test-sources</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>teamcity-configs-maven-plugin</artifactId>
<version>${teamcity.dsl.version}</version>
<configuration>
<format>kotlin</format>
<dstDir>target/generated-configs</dstDir>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin</artifactId>
<version>${teamcity.dsl.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-plugins</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-script-runtime</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Can you please help me how I should properly setup this pom.xml configuration to be usable in Android Studio? Android Studio project uses Gradle by default

Birt viewer to a Maven project for birt 4.3.1

Hi Iam new to birt and maven .Could any one help me how to convert a birt viewer as a maven project which needs be deployed in weblogic.Any suggestion or tutorial links will be a great help.
Thanks in Advance.
Create with this folder structure and create xml file named pom.xml .
Download the Birt runtime and you can find a birtviewer example (WebViewerExample).
.WebViewerExample(Root Folder)
.src
.main
.webapp
.WEB-INF
.lib
.web.xml
..(other files)
.new_report_1.rptdesign
...(other files)
.pom.xml
.target
.weblogic-maven-plugin.jar
Download BirtReportFramework and copy the jar files having names with 'org.eclipse.birt.report.data.oda' from birt-report-framework-4_3_1\eclipse\plugins to WebViewerExample\src\main\webapp\WEB-INF\lib
In command prompt got to Root folder here 'WebViewerExample' and run mvn clean install.
If you get maven error for missing or unable to download any jar files .No worries..you google the jar location in the maven website and download the jar manually and real trick is placing the jar at correct place inside your maven repository.
For Example if the error is like "[ERROR] Failed to execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.9:eclipse"
Go to Maven repository whose path is like .m2\repository\org\apache\maven\plugins\maven-eclipse-plugin\2.9
Inside 2.9 folder place the maven-eclipse-plugin-2.9.jar and maven-eclipse-plugin-2.9.pom.
Also try to download and place the dependent jar and pom if the maven not get for you due to some problem..
My pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.webviewer</groupId>
<artifactId>WebViewerExample</artifactId>
<packaging>pom</packaging>
<name>Birt Viewer Maven Project</name>
<version>0.0.1-SNAPSHOT</version>
<properties>
<jdk.version>1.6</jdk.version>
<logback.version>1.0.13</logback.version>
<junit.version>4.10</junit.version>
<spring.version>3.0.5.RELEASE</spring.version>
</properties>
<repositories>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
<id>sonatype-nexus-releases</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/releases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.birt.runtime</artifactId>
<version>4.3.1.v20130918-1142</version>
<!--<version>4.3.1</version> -->
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<!-- <packagingIncludes>/*.rptdesign</packagingIncludes>
<packagingIncludes>/*.jsp</packagingIncludes>
-->
<packagingExcludes>WEB-INF/lib/org.apache.xerces-2.9.0.jar</packagingExcludes>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>Apache_Tomcat_7_x86</server>
<path>/birtviewer</path>
</configuration>
</plugin>
</plugins>
</build>
Thanks,
Winds

no any "plugin descriptor" founded in my maven project

I am wanting to create UI with qt-jambi, but i have a problem.
i am using maven in eclipse, and create a maven project, and i downloaded and installed 3rd party qt-jambi jar files in my local repository from here:
http://old.qt-jambi.org/maven2/net/sf/qtjambi/
and below files:
(1) qtjambi-maven-plugin-linux32-4.5.2_01.jar
(2) qtjambi-platform-linux32-4.5.2_01.jar
i am using ubuntu 12.10(32bit) and Maven 3.0.4.
My maven repository(m2 home)path for qt-jambi is like below:
/home/mehdi/.m2/repository/net/sf/qtjambi/qtjambi/4.5.2_01/qtjambi-4.5.2_01.jar
/home/mehdi/.m2/repository/net/sf/qtjambi/qtjambi-maven-plugin-linux32/4.5.2_01/qtjambi-maven-plugin-linux32-4.5.2_01.jar
so i add this lines to my pom.xml: http://old.qt-jambi.org/users/maven-repository/
my pom.xml file is:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.iyasin</groupId>
<artifactId>iycTest</artifactId>
<version>2.0</version>
<packaging>jar</packaging>
<name>iycTest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>net.sf.qtjambi</groupId>
<artifactId>qtjambi</artifactId>
<version>4.5.2_01</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.sf.qtjambi</groupId>
<artifactId>qtjambi-maven-plugin-linux32</artifactId>
<executions>
<execution>
<id>qtjambi</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<sourcesDir>src/main/java</sourcesDir>
<noObsoleteTranslations>true</noObsoleteTranslations>
</configuration>
</plugin>
</plugins>
</build>
</project>
and when run mvn test or mvn compile return me below error:
Failed to parse plugin descriptor for net.sf.qtjambi:qtjambi-maven-plugin-linux32:4.5.2_01 (/home/mehdi/.m2/repository/net/sf/qtjambi/qtjambi-maven-plugin-linux32/4.5.2_01/qtjambi-maven-plugin-linux32-4.5.2_01.jar): No plugin descriptor found at META-INF/maven/plugin.xml -> [Help 1]
You need to add into the relevant part of your POM:
<pluginRepositories>
<pluginRepository>
<id>qtjambi-releases-before-2011</id>
<name>QtJambi (Releases Before 2011)</name>
<url>http://repository.qt-jambi.org/nexus/content/repositories/releases-before-2011</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
The above can be put into your settings.xml or project POM.
You should really run a local repository proxy (such as Nexus or Artifactory). Then setup your settings.xml to point to that local repository. Then configure it to cache central and qtjambi and other repositories you use. However that benefits of this are too long to go into here, best to research the topic with google.

Onejar, with maven, won't copy resource into jar

I'm using one-jar to package up my program. I have resources in src/main/resources. The maven-resources-plugin correctly copies the resources into the jar, but the jar produced by onejar does not contain my resources.
Here's my pom:
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ziroby</groupId>
<artifactId>resourceTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>resourceTest</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.dstovall</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<version>1.4.4</version>
<executions>
<execution>
<configuration>
<attachToBuild>true</attachToBuild>
</configuration>
<goals>
<goal>one-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>onejar-maven-plugin.googlecode.com</id>
<url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url>
</pluginRepository>
</pluginRepositories>
</project>
What am I doing wrong? How do I include resources in one-jar?
I have discovered my error. It was putting it in the jar, just not where I expected it to be. It's contained in a jar inside the main jar. Specifically, resourceTest-0.0.1-SNAPSHOT.one-jar.jar contains resourceTest-0.0.1-SNAPSHOT.jar, which contains my resource.
Now I just need to find out how to access the resource, but that's another question, which warrants more research.
If you are using something similar to:
getClass().getClassLoader().getResourceAsStream
Try instead using: Thread.currentThread().getContextClassLoader().getResourceAsStream

Resources