Can I get IntelliJ to use different compilers for different classes?
I have a Spring project that uses Spring transcation managment via compile time weaving with AspectJ. Within in that project I have a bunch of transaction spring integration tests. More specifically they use the following annotations :
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationTestContext.xml"})
@Transactional
@TransactionConfiguration(defaultRollback = true)
public class SomethingTest extends DocumentServicesImplTest {
...
@BeforeTransaction
public void setUp() {
....
}
}
Now if this test is compiled using ajc, I've found that the @Transcational annotation stuff is effectively ignored. In other works @BeforeTranscation doesn't execute, the transaction doesn't roll back, etc...
So in my pom.xml I excluded my unit tests from aspectJ compiler:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<verbose>true</verbose>
<source>1.6</source>
<target>1.6</target>
<complianceLevel>1.6</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<!-- by not placing test-compile here AJC doesn't run on the test -->
</goals>
</execution>
</executions>
</plugin>
Now unforutnately what seems to happen when I run the unit tests is the that the "make" option compiles my test using AJC and then the test fails. Is there a way for me to tell IntelliJ to use compile the test using the regular java compiler prior to runing?
请先登录再写评论。
Compiler setting is currently per project, not even per module, see the related issue: http://youtrack.jetbrains.net/issue/IDEA-51666 .