title: Using different JBoss BOM in profiles
body: <p>I have a general question about the usage of the BOM from JBoss and WildFly.
  Is the a way to build a project for both JBoss 7 and WildFly 10 using a different profile?</p>
  
  <p>I tried to copy the BOM definition from WildFly into a profile like this:</p>
  
  <pre><code>&lt;profile&gt;
      &lt;id&gt;WildFly10&lt;/id&gt;
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;         
              &lt;dependency&gt;
                  &lt;groupId&gt;org.wildfly.bom&lt;/groupId&gt;
                  &lt;artifactId&gt;wildfly-javaee7-with-tools&lt;/artifactId&gt;
                  &lt;version&gt;${version.jboss.bom}&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;!-- JSON --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.json&lt;/groupId&gt;
                  &lt;artifactId&gt;json&lt;/artifactId&gt;
                  &lt;version&gt;${version.json}&lt;/version&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  &lt;/profile&gt;
  </code></pre>
  
  <p>Of course accourdingly with a JBoss7 profile.</p>
  
  <p>But this way it won't add important libraries to the lib folder, i.e. this definition is in an ear pom and a subproject (war) adds the json dependency. Without a profile maven adds the json jar inside the lib folder, but not if I put it inside a profile.</p>
  
  <p>After I read that changing dependencies in a profile is an anti-pattern [<a href="https://stackoverflow.com/questions/11940670/using-profiles-in-multimodule-project" title="[1]">1</a>] I would like to know how I can build my project for both JBoss7 and WildFly 10.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Ok sorry for this quick shot of a question. Here are more details.</p>
  
  <p>project structure:</p>
  
  <pre><code>|-parent (pom)
    |- myapp (war)
    |- core (jar)
    |- deployment (ear)
  </code></pre>
  
  <p>So <code>deployment</code> is the project building the whole ear containing <code>myapp</code> as a web apllication and <code>core</code> as a library. <code>myapp</code> has a dependency to <code>core</code> and <code>core</code> to <code>json</code>.</p>
  
  <p>In order to have all needed depenedencies with the correct version I included <code>wildfly-javaee7-with-tools</code> in the dependencyManagment. Also is the version of <code>json</code> defined in there. The <code>core</code> project has the <code>json</code> library as a normal dependency.</p>
  
  <p>At this point this should be quite standard. But the thing is I want to be able to build for JBoss 7 and WildFly 10, for what I have to change </p>
  
  <pre><code>            &lt;dependency&gt;
                  &lt;groupId&gt;org.wildfly.bom&lt;/groupId&gt;
                  &lt;artifactId&gt;wildfly-javaee7-with-tools&lt;/artifactId&gt;
                  &lt;version&gt;${version.jboss.bom}&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
  </code></pre>
  
  <p>to</p>
  
  <pre><code>            &lt;dependency&gt;
                  &lt;groupId&gt;org.jboss.bom&lt;/groupId&gt;
                  &lt;artifactId&gt;jboss-javaee-6.0-with-tools&lt;/artifactId&gt;
                  &lt;version&gt;${version.jboss.bom}&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
  </code></pre>
  
  <p>Of course <code>${version.jboss.bom}</code> will be changed from <code>10.1.0.Final</code> for WildFly to <code>1.0.7.Final</code> for JBoss.</p>
  
  <p>In order to do so I tried to move <code>wildfly-javaee7-with-tools</code> into a profile. My first guess was to only move this dependency to a profile. But then the <code>json</code> jar doesn't get included. After that I also tried to move <code>json</code>like above.</p>