Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-12121

Application wizard: the openshift profile is added to newly created maven projects, regardless of their packaging type

    XMLWordPrintable

Details

    • Hide
      1. ASSERT: make sure that you have http://open-archetypes.github.com/maven-repo/snapshots/archetype-catalog.xml added to your maven archetype catalog (Maven > Archetypes > Add Remote Catalog)
      2. EXEC: File->New->Maven Project->NEXT, choose openarchetype archetype catalog and check "include snapshot archetypes":

      1. EXEC: hit Next and set openshift_enable to No

      1. EXEC: hit Finish and get several projects created in your workspace (ex. I chose artifactId "test", I got test, test-ear, test-ejb, test-util, test-web)
      2. EXEC: launch OpenShift Application wizard, choose to create a new app and uncheck use existing project. Select the parent-project of the freshly created projects (test in my case)
      3. EXEC: hit Finish and let the wizard merge the OpenShift applicatin into your parent-project.

      Result:
      The pom in the parent-project gets the openshift profile added. But the profile is building a war:

      <id>openshift</id>
      <build>
         <finalName>test</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>
      
      Show
      ASSERT: make sure that you have http://open-archetypes.github.com/maven-repo/snapshots/archetype-catalog.xml added to your maven archetype catalog (Maven > Archetypes > Add Remote Catalog) EXEC: File->New->Maven Project->NEXT, choose openarchetype archetype catalog and check "include snapshot archetypes": EXEC: hit Next and set openshift_enable to No EXEC: hit Finish and get several projects created in your workspace (ex. I chose artifactId "test", I got test, test-ear, test-ejb, test-util, test-web) EXEC: launch OpenShift Application wizard, choose to create a new app and uncheck use existing project . Select the parent-project of the freshly created projects ( test in my case) EXEC: hit Finish and let the wizard merge the OpenShift applicatin into your parent-project. Result: The pom in the parent-project gets the openshift profile added. But the profile is building a war: <id>openshift</id> <build> <finalName>test</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>
    • Medium

    Description

      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 :

      <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>
      

      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) :
        <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>
        
      • 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) :
        <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>
        

        The finalName is irrelevant to openshift, only the warName counts.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              fbricon@redhat.com Fred Bricon
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: