[
https://issues.jboss.org/browse/FORGE-440?page=com.atlassian.jira.plugin....
]
Claus Ibsen commented on FORGE-440:
-----------------------------------
Here is an example of before vs after. We have a fabric8-setup command that makes a maven
project ready for openshift/fabric8.
{code}
[dude]$ cat 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.dude</groupId>
<artifactId>dude</artifactId>
<packaging>jar</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>A Camel Spring Route</name>
<url>http://www.myorganization.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.16.2</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>2.16.2</version>
</dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-spring</artifactId>
<version>2.16.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- allows the route to be ran via 'mvn camel:run' -->
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<version>2.16.2</version>
</plugin>
</plugins>
</build>
</project>
{code}
And now after
{code}
[dude]$ fabric8-setup
***SUCCESS*** Added Fabric8 Maven support with base Docker image:
fabric8/java-jboss-openjdk8-jdk:1.0.10. Added the following Maven profiles [f8-build,
f8-deploy, f8-local-deploy] to make building the project easier, e.g. mvn
-Pf8-local-deploy
[dude]$ cat pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.dude</groupId>
<artifactId>dude</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>A Camel Spring Route</name>
<url>http://www.myorganization.org</url>
<properties>
<docker.assemblyDescriptorRef>artifact-with-dependencies</docker.assemblyDescriptorRef>
<docker.from>docker.io/fabric8/java-jboss-openjdk8-jdk:1.0.10</docker.from>
<docker.image>fabric8/${project.artifactId}:${project.version}</docker.image>
<docker.port.container.jolokia>8778</docker.port.container.jolokia>
<fabric8.iconRef>icons/camel</fabric8.iconRef>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.16.2</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>2.16.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-spring</artifactId>
<version>2.16.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<version>2.16.2</version>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.14.1</version>
<configuration>
<images>
<image>
<name>${docker.image}</name>
<build>
<from>${docker.from}</from>
<assembly>
<basedir>/app</basedir>
<descriptorRef>${docker.assemblyDescriptorRef}</descriptorRef>
</assembly>
<env>
<JAVA_MAIN_CLASS>org.apache.camel.spring.Main</JAVA_MAIN_CLASS>
</env>
</build>
</image>
</images>
</configuration>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>2.2.96</version>
<executions>
<execution>
<id>json</id>
<phase>generate-resources</phase>
<goals>
<goal>json</goal>
</goals>
</execution>
<execution>
<id>attach</id>
<phase>package</phase>
<goals>
<goal>attach</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>f8-build</id>
<build>
<defaultGoal>clean install docker:build fabric8:json</defaultGoal>
</build>
</profile>
<profile>
<id>f8-deploy</id>
<build>
<defaultGoal>clean install docker:build docker:push fabric8:json
fabric8:apply</defaultGoal>
</build>
<properties>
<fabric8.recreate>true</fabric8.recreate>
<fabric8.imagePullPolicySnapshot>Always</fabric8.imagePullPolicySnapshot>
</properties>
</profile>
<profile>
<id>f8-local-deploy</id>
<build>
<defaultGoal>clean install docker:build fabric8:json
fabric8:apply</defaultGoal>
</build>
<properties>
<fabric8.recreate>true</fabric8.recreate>
</properties>
</profile>
</profiles>
</project>
{code}
A pom.xml which contains comments loses all of them after Forge
operates on it.
-------------------------------------------------------------------------------
Key: FORGE-440
URL:
https://issues.jboss.org/browse/FORGE-440
Project: Forge
Issue Type: Bug
Components: Build Tools - Maven
Affects Versions: 1.0.6.Final
Environment: HEAD
Reporter: Pete Muir
Fix For: 3.x Future
Attachments: pomComments.png
Also looses formatting, but this is less of an issue.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)