Intellij idea IntelliJ 14使用AspectJ inpath

Intellij idea IntelliJ 14使用AspectJ inpath,intellij-idea,aspectj,intellij-14,Intellij Idea,Aspectj,Intellij 14,除了我的货源,我还需要织几个罐子。在Eclipse/Ant中,实现这一点的方法是使用inpath选项。Ant和Eclipse为以这种方式添加JAR提供了重要支持。IntelliJ有类似的功能吗(我使用的是14) 我使用了AspectJ Weaver插件,但它不允许我对JAR中的方法提出建议 编辑:我使用了-inpath作为额外的命令行参数,但是我从中得到了编译错误,这表明它无法找出inpath jar中任何类的基类 Edit2:现在我没有使用intellij的make,而是使用Ant构建输出。这

除了我的货源,我还需要织几个罐子。在Eclipse/Ant中,实现这一点的方法是使用inpath选项。Ant和Eclipse为以这种方式添加JAR提供了重要支持。IntelliJ有类似的功能吗(我使用的是14)

我使用了AspectJ Weaver插件,但它不允许我对JAR中的方法提出建议

编辑:我使用了
-inpath
作为额外的命令行参数,但是我从中得到了编译错误,这表明它无法找出inpath jar中任何类的基类

Edit2:现在我没有使用intellij的make,而是使用Ant构建输出。这并不理想,但它可以工作,并且没有太多的速度损失

编辑3: 用于-inpath编译的jar:spring-tx-3.2.11、spring-orm-3.2.11、spring-binding-2.3.1

从intellij构建的调试日志来看,这几乎适用于JAR中的每个类

 [Xlint:cantFindType]' @(no source information available)
/Users/dlikhten/Developer/workspaces/x/src/x-web/web/war/WEB-INF/lib/spring-binding-2.3.1.RELEASE.jar:0::0 
2014-12-10 13:28:52,992 [  23440]  DEBUG - ng.aspectj.build.AjBuilderBase - error: 'can't determine superclass of missing type javax.el.PropertyNotWritableException
when weaving type org.springframework.binding.expression.el.MapAdaptableELResolver

尽管我在很大程度上喜欢IntelliJ IDEA,但我必须承认,每当处理AspectJ时,我都会切换到Eclipse,因为IDEA对AspectJ的支持不是最先进的。好的,AspectJ是一个Eclipse项目,所以很好的支持是意料之中的,但无论如何

我发现在外部库上使用inpath的唯一方法实际上是为您的项目定制Ajc命令行,只需添加一个
-inpath my/external/lib.jar


更新:

下面是我的小演示项目,其中包含一个方面和一个使用ApacheCommonsCompress1.9的驱动程序应用程序。只需确保更改示例ZIP文件的路径即可使其运行:

公共方面{
before():执行(public**(..){
System.out.println(此连接点);
}
}
import org.apache.commons.compress.archivers.ArchiveEntry;
导入org.apache.commons.compress.archivers.ArchiveException;
导入org.apache.commons.compress.archivers.ArchiveInputStream;
导入org.apache.commons.compress.archivers.ArchiveStreamFactory;
导入java.io.BufferedInputStream;
导入java.io.FileInputStream;
导入java.io.IOException;
公共班机{
公共静态void main(字符串[]args)引发IOException、ArchiveException{
System.out.println(“你好,世界!”);
ArchiveInputStream输入=新建ArchiveStreamFactory()。createArchiveInputStream(
新的BufferedInputStream(
新文件输入流(“c:\\Users\\Alexander\\Downloads\\rudi.zip”)
)
);
档案中心入口;
而((entry=input.getNextEntry())!=null){
系统输出打印项次(输入);
}
}
}
在inpath上没有commons-compress-1.9.jar的控制台输出:

如您所见,aspect有效。它拦截主方法的执行。然后主方法打印“Hello world!”和我的示例zip中的3个文件名

执行(void Main.Main(String[]))
你好,世界!
index.cgi
upload.cgi
cmd.cgi
在inpath上使用commons-compress-1.9.jar进行控制台输出:

现在将外部JAR放在inpath上,如屏幕截图所示请使用完整路径我们现在希望看到许多来自Commons Compress的公共方法执行也被方面截获和记录。实际上,在“Build”->“Rebuild project”之后,输出更改为:

执行(void Main.Main(String[]))
你好,世界!
执行(ArchiveInputStream org.apache.commons.compress.archivers.ArchiveStreamFactory.createArchiveInputStream(InputStream))
执行(int org.apache.commons.compress.utils.IOUtils.readFully(InputStream,字节[])
执行(int org.apache.commons.compress.utils.IOUtils.readFully(InputStream,字节[],int,int))
执行(byte[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes())
执行(字节[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes(长))
执行(byte[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes())
执行(字节[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes(长))
执行(byte[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes())
执行(字节[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes(长))
执行(boolean org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.matches(字节[],int))
执行(byte[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes())
执行(字节[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes(长))
执行(byte[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes())
执行(字节[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes(长))
执行(byte[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes())
执行(字节[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes(长))
执行(字节[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes(长))
执行(字节[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes(长))
执行(字节[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes(长))
执行(字节[]org.apache.commons.compress.archivers.zip.ZipLong.getBytes(长))
执行(ZipEncoding org.apache.commons.compress.archivers.zip.ZipEncodingHelper.getZipEncoding(字符串))
执行(ArchiveEntry org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.getNextEntry())
执行(ZipArchiveEntry org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.getNextZipEntry())
执行(int org.apache.commons.compress.utils.IOUtils.readFully(InputStream,字节[])
执行(int org.apache.commons.compress.utils.IOUtils.readFully(InputStream,字节[],int,int))
执行(long org.apache.commons.compress.archivers.zip.ZipLong.getValue(字节[],int))
执行(boolean org.apache.commons.compress.archivers.zip.ZipLong.equals(对象))
执行(long org.apache.commons.compress.archivers.zip.ZipLong.getValue())
执行(boolean org.apache.commons.comp)