我使用struts2-archtype-starter在eclipse中创建了一个新的struts项目.
在做任何事情之前我的项目中已经出现了一些错误.解决了他们中的大多数,但有1仍然给我一些问题.
Missing artifact com.sun:tools:jar:1.5.0:system pom.xml
我试图手动将tools.jar添加到我的存储库,但这并没有解决问题.
我的pom看起来像这样
<?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>com.divespot</groupId>
<artifactId>website</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>E-Divespot diving community</name>
<url>http://www.e-divespot.com</url>
<description>A website to support divers from all around the world.</description>
<dependencies>
<!-- Junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<!-- Struts 2 -->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.0.11.2</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
<version>2.0.11.2</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.0.11.2</version>
</dependency>
<!-- Servlet & Jsp -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version> …Run Code Online (Sandbox Code Playgroud) 我可能只是在寻找错误的方向,但我发现注释处理的JSE文档非常稀疏.我想编写一个注释处理器,它处理带注释的String字段和局部变量,用计算的String表达式替换它们.这不应该太复杂,但我在Javadoc for javax.annotation.processing中迷失了.
编辑:我需要在编译时处理注释,因为我想修改生成的代码.它应该用计算的String表达式替换带注释的常量String表达式.
我试图从Java Annotation Processor中访问类型的实际原始源代码.这有可能吗?谢谢!
我想用来JavaCompiler动态创建一些类.
我找到了javax.tools包的源代码,但是没有实现; 互联网上的一些帖子说它依赖于tools.jar,我不确定是否tools.jar与JRE有关.
那么,我可以在没有安装JDK的JRE环境中运行程序吗?
另一个问题,即实现细节JavaCompiler是什么,是创建一个新的进程来调用javac命令?
谢谢