[jbosstools-issues] [JBoss JIRA] (JBIDE-12121) The openshift profile is added to newly created maven projects, regardless of their packaging type

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Fri Sep 21 14:09:35 EDT 2012


    [ https://issues.jboss.org/browse/JBIDE-12121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12720748#comment-12720748 ] 

Andre Dietisheim edited comment on JBIDE-12121 at 9/21/12 2:09 PM:
-------------------------------------------------------------------

Rewriting according to my current understanding:

I have to look at all modules of the given project - that the wizard will merge into - and find out about their <packaging>. 

* if there are ears, I'll use the following profile
{code}
<profile>
 <id>openshift</id>
 <build>
   <pluginManagement>
    <plugins>
       <plugin>
          <artifactId>maven-ear-plugin</artifactId>
          <version>2.7</version>
          <configuration>
             <outputDirectory>deployments</outputDirectory>
          </configuration>
       </plugin>
    </plugins>
  </pluginManagement>
 </build>
</profile>
{code}


* if there are wars, but no ears, I'll use the following profile:
{code}
<profiles>
<profile>
<id>openshift</id>
<build>
  <pluginManagement>
   <plugins>
     <plugin>
       <artifactId>maven-war-plugin</artifactId>
       <version>2.2</version>
       <configuration>
         <outputDirectory>deployments</outputDirectory>
         <!-- Add warName ROOT ONLY if there's ONE War, otherwise, skip it -->
         <warName>ROOT</warName>
       </configuration>
     </plugin>
   </plugins>
  </pluginManagement>
 </build>
</profile>
{code}

* otherwise I'll use the default profile:
{code}
<profile>
<id>openshift</id>
<build>
   <finalName>hello</finalName>
   <plugins>
     <plugin>
       <artifactId>maven-war-plugin</artifactId>
       <version>2.1.1</version>
       <configuration>
         <outputDirectory>deployments</outputDirectory>
         <warName>ROOT</warName>
       </configuration>
     </plugin>
   </plugins>
 </build>
</profile>
{code}

I'm currently looking for m2e API how to get the submodules for a given project and find out about their packaging. 
I looked into the maven source and chattet with fbricon which did not know things by heart. I'll have to further investigate and eventually ask on the m2e mailing-list.
                
      was (Author: adietish):
    Rewriting according to my current understanding:

I have to look at all modules of the given project - that the wizard will merge into - and find out about their <packaging>. 

* if there are ears, I'll use the following profile
{code}
<profile>
 <id>openshift</id>
 <build>
   <pluginManagement>
    <plugins>
       <plugin>
          <artifactId>maven-ear-plugin</artifactId>
          <version>2.7</version>
          <configuration>
             <outputDirectory>deployments</outputDirectory>
          </configuration>
       </plugin>
    </plugins>
  </pluginManagement>
 </build>
</profile>
{code}


* if there are wars, but no ears, I'll use the following profile:
{code}
<profiles>
<profile>
<id>openshift</id>
<build>
  <pluginManagement>
   <plugins>
     <plugin>
       <artifactId>maven-war-plugin</artifactId>
       <version>2.2</version>
       <configuration>
         <outputDirectory>deployments</outputDirectory>
         <!-- Add warName ROOT ONLY if there's ONE War, otherwise, skip it -->
         <warName>ROOT</warName>
       </configuration>
     </plugin>
   </plugins>
  </pluginManagement>
 </build>
</profile>
{code}

* otherwise I'll use the default profile:

{code}
<profile>
<id>openshift</id>
<build>
   <finalName>hello</finalName>
   <plugins>
     <plugin>
       <artifactId>maven-war-plugin</artifactId>
       <version>2.1.1</version>
       <configuration>
         <outputDirectory>deployments</outputDirectory>
         <warName>ROOT</warName>
       </configuration>
     </plugin>
   </plugins>
 </build>
</profile>
{code}

I'm currently looking for m2e API how to get the submodules for a given project and find out about their packaging. 
I looked into the maven source and chattet with fbricon which did not know things by heart. I'll have to further investigate and eventually ask on the m2e mailing-list.
                  
> The openshift profile is added to newly created maven projects, regardless of their packaging type
> --------------------------------------------------------------------------------------------------
>
>                 Key: JBIDE-12121
>                 URL: https://issues.jboss.org/browse/JBIDE-12121
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: openshift
>    Affects Versions: 3.3.0.CR1
>            Reporter: Fred Bricon
>            Assignee: Andre Dietisheim
>             Fix For: 3.3.2, 4.0.x
>
>         Attachments: new-openarchetype-project-2.png, new-openarchetype-project.png
>
>
> I created a project using the org.openarchetypes:multi-javaee6-archetype:0.0.1-SNAPSHOT from http://open-archetypes.github.com/maven-repo/snapshots/archetype-catalog.xml (Maven > Archetypes > Add Remote Catalog)
> This creates a multi module project, containing a parent pom, an ear, war, ejb and utility projects. This openshift profile was added to the pom project : 
> {code:xml}
> <profiles>
> <profile>
> <!-- When built in OpenShift the openshift profile will be used when invoking mvn. -->
> <!-- Use this profile for any OpenShift specific customization your app will need. -->
> <!-- By default that is to put the resulting archive into the deployments folder. -->
> <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
> <id>openshift</id>
> <build>
>    <finalName>hello</finalName>
>    <plugins>
>      <plugin>
>        <artifactId>maven-war-plugin</artifactId>
>        <version>2.1.1</version>
>        <configuration>
>          <outputDirectory>deployments</outputDirectory>
>          <warName>ROOT</warName>
>        </configuration>
>      </plugin>
>    </plugins>
>  </build>
> </profile>
> {code}
> Actually, it should :
> - check the packaging type of *all* the generated projects
> - if some EARs are found, then add the following to the parent pom  (pay attention to the <pluginManagement> section)  :
> {code:xml}
> <profile>
>  <id>openshift</id>
>  <build>
>    <pluginManagement>
>     <plugins>
>        <plugin>
>           <artifactId>maven-ear-plugin</artifactId>
>           <version>2.7</version>
>           <configuration>
>              <outputDirectory>deployments</outputDirectory>
>           </configuration>
>        </plugin>
>     </plugins>
>   </pluginManagement>
>  </build>
> </profile>
> {code}
> - if there are no EARs but some WARs are found (count them), then add the following to the parent pom  (pay attention to the <pluginManagement> section) :
> {code:xml}
> <profiles>
> <profile>
> <id>openshift</id>
> <build>
>   <pluginManagement>
>    <plugins>
>      <plugin>
>        <artifactId>maven-war-plugin</artifactId>
>        <version>2.2</version>
>        <configuration>
>          <outputDirectory>deployments</outputDirectory>
>          <!-- Add warName ROOT ONLY if there's ONE War, otherwise, skip it -->
>          <warName>ROOT</warName>
>        </configuration>
>      </plugin>
>    </plugins>
>   </pluginManagement>
>  </build>
> </profile>
> {code}
> The finalName is irrelevant to openshift, only the warName counts.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list