Compiling to /WEB-INF/dev ?

How can I permanently set my WAR module classes export to another Iocation than "WEB-INF/classes"?

In my .iml-file is can put


<containerElement type="module" name="%MODULE-NAME%">
             <attribute name="method" value="1" />
             <attribute name="URI" value="/WEB-INF/dev" />
</containerElement>


but everytime I load my project it gets overridden again (it's a Maven project).

Any ideas? - I need this for Seam Hot Deployment btw

0
9 comments

so I guess this is not possible, huh?

0

Hi,

Can you attach your pom file please?

Thanks,
Anton Makeev

0

Actually the pom is > 1300 lines so I'm cutting it down to the presumably important sections:

<?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>myproject</groupId>
    <artifactId>author-web</artifactId>
    <packaging>war</packaging>f
    <version>0.0.4</version>
    <name>Authoring Portal</name>


    <build>
        <finalName>author</finalName>


        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                ...

            </plugin>
        </plugins>


        <resources>
            <resource>
                <filtering>true</filtering>
                <directory>${basedir}/src/main/resources</directory>
            </resource>
        </resources>


        <testResources>
            <testResource>
                <filtering>true</filtering>
                <directory>${basedir}/src/test/resources</directory>
                <excludes>
                    <exclude>testFiles/*</exclude>
                </excludes>
            </testResource>
        </testResources>
    </build>


    <dependencies>
    ...
    </dependencies>


</project>

There is also a huge profiles-section, but none of them change anything '<build>'-related.

I simply can't figure out how to change IntelliJ to output the WEB-INF classes to '%PROJ-DIR%/target/exploded/WEB-INF/dev' or similar (instead of '%PROJ-DIR%/target/exploded/WEB-INF/classes').

0

I got you problem now,
The problem is that Maven knows nothing about a specific classes dir (web-inf/dev) and so IDEA does. IDEA simply adjusts its model into accordance with Maven pom files.

Please take a look at http://ctpjava.blogspot.com/2008/12/using-jboss-seam-hot-deployment-with.html.

Thanks,
Anton Makeev

0

Thanks for the suggestion!

I know that there is nothing in my pom that tells IDEA to compile to WEB-INF/dev, it's exactly my question how I tell IDEA via Maven to use it

I read the article and tried the plugin. I understand how it would work as a Maven-only approach, but I want IDEA itself to compile to WEB-INF/dev (it's much faster).

It probably comes to this question: What property/setting does IDEA pick up from Maven to set the path to WEB-INF/classes (if any)?

0

IDEA relies on the standard location, that is WEB-INF/classes.
Unfortunately, at the moment IDEA would rewrite all packaging information on every re-import from Maven.
Probably I could weaken this restriction and leave the specific entry (module's output) unchanged, not sure about this, though. What do you think?

Thanks,
Anton Makeev

0

I tried a few things.
I was actually able to change the output path to WEB-INF/dev permanently (so there is no need to change anything so far in IDEA).
I set the <outputDirectory> (under <build>) to
    <outputDirectory>target/${compile.dir}</outputDirectory>
Then I set the default global value of ${compile.dir} to 'classes' (so that my CI still compiles regularly) and set the value to 'target/WEB-INF/dev' in my development profile. At each re-import the appropriate path is picked up by IDEA! Cool

(This could work nicely with JavaRebel (which I'm also evaluating currently), because on each 'Make' one can force IDEA to compile directly to the exploded-dir's WEB-INF/classes.)

The only problem when it comes to Seam's Hot Deployment is that IDEA now compiles/copies the classes to 2 locations: WEB-INF/dev (regular compile output) & WEB-INF/classes (WAR compile output/copy). So I would have to delete the /classes-files via Maven (Ant task) on each 'Make'. Actually this is exactly the reverse approach of my initial plan (to move the .class-files to /dev via Ant). Both still involve a call to Maven, which is quite slow due to it's startup time overhead.

So the last thing we would have to figure out is how to either stop IDEA from forwarding the compile results to the WAR module's WEB-INF/classes or to also change this path so that all outputs are directed to WEB-INF/dev.

0

I just noticed a side effect: The resources under WEB-INF/classes are not filtered, the ones under WEB-INF/dev are...hm.

0

In the next 8.x eap IDEA won't reset changed packaging location for the module's classes.
Please let me know if it helps when you try it.

Thanks,
Anton Makeev

0

Please sign in to leave a comment.