Andrei Micu
Andrei Micu

Reputation: 3249

Using JBoss modules in IDEs like Eclipse

I currently started my JavaEE course at the faculty and I installed Eclipse for JavaEE. I installed JBoss 7.1.1 from the Eclipse Marketplace and I started developing applications, all worked fine.

Now, I reached a point where I need a specific library (Apache Commons IO) that the server has as a module. The point is I need to get this module in the development environment somehow. I added the JAR from the server folder to the WEB-INF/lib folder and as a JAR dependency in my project, but I think there is a more elegant solution.

Is there a way I can automatically add the server modules in the Eclipse environment?

P.S.: I must mention that the project I created is a simple Dynamic Web Project, not the kind of project that the JBoss plugin creates and I intend to stay with this type of project because the course asks to develop this way.

Upvotes: 0

Views: 364

Answers (2)

Andrei Micu
Andrei Micu

Reputation: 3249

The solution was to learn Maven and use the m2eclipse plugin for Eclipse. My final POM is looking like this:

<build>
    <sourceDirectory>${basedir}/src</sourceDirectory>
    <resources>
      <resource>
        <directory>${basedir}/src</directory>
        <excludes>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <warSourceDirectory>${basedir}/WebContent</warSourceDirectory>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.0</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
      <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
                <version>7.4.Final</version>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
  </dependencies>

Upvotes: 1

Sai Ye Yan Naing Aye
Sai Ye Yan Naing Aye

Reputation: 6738

Try to use Maven for your development environment.It may be the answer of your question. Here are some useful links of Maven

Upvotes: 1

Related Questions