ant 编译脚本问题
ant build.xml编译带有标注的java文件时报错。java文件:
package com.greatmay.model;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.hibernate.annotations.NamedQueries;
import org.hibernate.annotations.NamedQuery;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
@NamedQueries({
@NamedQuery(
name = "book.orderByDate",
query = "from Book s order by status asc, presentDate desc "
),
@NamedQuery(
name = "book.countAll",
query = "select Count(*) from Book s"
),
@NamedQuery(
name = "book.findFree",
query = "from Book s where s.price = 0 order by status asc, presentDate desc "
),
@NamedQuery(
name = "book.countFree",
query = "select Count(*) from Book s where s.price = 0 "
),
})
@JsonIgnoreProperties(value={"categories"})
@Entity
@Table(name = "book")
@Indexed
@XmlRootElement
public class Book extends BaseObject {
private static final long serialVersionUID = -7869107480253849972L;
public static final String QUERY_ORDERBYDATE = "book.orderByDate";
public static final String COUNT_COUNTALL = "book.countAll";
public static final String QUERY_FINDFREE = "book.findFree";
public static final String COUNT_COUNTFREE = "book.countFree";
public static final String QUERY_ORDERBYCOMMENTS = "book.orderByComments";
public static final String QUERY_ORDERBYSALES = "book.orderBySales";
public static final String DESCRIPTION_PIC = "cover.jpg";
public static final String PREVIEW_PIC = "preview.jpg";
public static final String DETAILS_PAGE = "details.html";
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@DocumentId
private Long id;
@Column(nullable = true)
private String name;;
@Column(nullable = true)
private String fileName;
@Column(nullable = true)
@Field
private String category;
@Column(nullable = true)
private String descFolderPath;
@Column(nullable = true, length=511)
@Field
private String brief;
@Column(nullable = true, length=1023)
@Field
private String description;
@Column(nullable = true)
@Field
private String otherinfo;
@Column(nullable = true)
@Field
private String publisher;
@Column(nullable = true)
private Date presentDate;
@Column(nullable = true)
@Field
private String author;
@Column(nullable = true)
@Field
private String releationbook;
@Column(nullable = true)
private Long point;
@Column(nullable = true)
private Double price;
@Column(nullable = true)
private Double priceInSales;
@Column(nullable = true)
@Enumerated(EnumType.ORDINAL)
private ProductStatus status;
@Column(nullable = true)
@Field
private String publicOrder;
@Column(nullable = true)
@Field
private String pages;
@Column(nullable = true)
@Field
private String words;
@Column(nullable = true)
@Field
private Date printDate;
@Column(nullable = true)
@Field
private String kb;
@Column(nullable = true)
@Field
private String 易做图;
@Column(nullable = true)
@Field
private String isbn;
@Column(nullable = true)
@Field
private String pakage;
@Column(nullable = true)
@Field
private int pjCnt;
@Column(nullable = true)
@Field
private int buyCnt;
/**
* Default constructor - creates a new instance with no values set.
*/
public Book() {
}
public Long getId() {
return id;
}
@Transient @XmlTransient
public List<String> getCategories() {
if (category == null || category.isEmpty()) {
return new ArrayList<String>(0);
}
String[] categorisArray = category.split(",");
List<String> categories = new ArrayList<String>(categorisArray.length);
Collections.addAll(categories, categorisArray);
Collections.sort(categories);
return categories;
}
public void setCategories(List<String> categories) {
if (categories != null) {
StringBuilder sb = new StringBuilder();
for (String s : categories) {
sb.append(Category.SPERATER).append(s);
}
if (sb.length() >= 1) {
sb.deleteCharAt(0);
}
this.category = sb.toString();
}
}
public void setCategories(String[] categories) {
if (categories != null) {
StringBuilder sb = new StringBuilder();
for (String s : categories) {
sb.append(Category.SPERATER).append(s);
}
if (sb.length() >= 1) {
sb.deleteCharAt(0);
}
this.category = sb.toString();
}
}
public String getCategory() {
return category;
}
public String getBrief() {
return brief;
}
public String getDescription() {
return description;
}
public String getOtherinfo() {
return otherinfo;
}
public String getName() {
return name;
}
public String getPublisher() {
return publisher;
}
public Date getPresentDate() {
return presentDate;
}
public String getAuthor() {
return author;
}
public Double getPrice() {
return price;
}
public Double getPriceInSales() {
return priceInSales;
}
public ProductStatus getStatus() {
return status;
}
public void setId(Long id) {
this.id = id;
}
public void setCategory(String category) {
this.category = category;
}
public void setBrief(String brief) {
this.brief = brief;
}
public void setDescription(String description) {
this.description = description;
}
public void setOtherinfo(String otherinfo) {
this.otherinfo = otherinfo;
}
public void setName(String name) {
this.name = name;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public void setPresentDate(Date presentDate) {
this.presentDate = presentDate;
}
public void setAuthor(String author) {
this.author = author;
}
public void setPrice(Double price) {
this.price = price;
}
public void setPriceInSales(Double priceInSales) {
this.priceInSales = priceInSales;
}
public void setStatus(ProductStatus status) {
this.status = status;
}
public String getFileName() {
return fileName;
}
public String getDescFolderPath() {
return descFolderPath;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public void setDescFolderPath(String descFolderPath) {
this.descFolderPath = descFolderPath;
}
public Long getPoint() {
return point;
}
public void setPoint(Long point) {
this.point = point;
}
@Transient
public String getDisplayBrief(int length) {
if (brief != null && brief.length() > length) {
return brief.substring(0, length - 1) + "……";
}
return brief;
}
@Transient
public String getDisplayDescription(int length) {
if (description != null && description.length() > length) {
return description.substring(0, length - 1) + "……";
}
return description;
}
@Transient
public Double getRealPrice() {
if (price == 0) {
return price;
} else if (priceInSales <= 0){
return price;
} else {
return price <= priceInSales ? price : priceInSales;
}
}
@Transient
public String getZk() {
if (price == 0) {
return "无";
}
Double z = getRealPrice()/price*10;
DecimalFormat df = new DecimalFormat("0.0");
String filesize = df.format(z);//返回的是String类型的
if("10".equals(filesize)){
return "无";
}else{
return filesize;
}
}
public String getReleationbook() {
return releationbook;
}
public void setReleationbook(String releationbook) {
this.releationbook = releationbook;
}
public String getPublicOrder() {
return publicOrder;
}
public void setPublicOrder(String publicOrder) {
this.publicOrder = publicOrder;
}
public String getPages() {
return pages;
}
public void setPages(String pages) {
this.pages = pages;
}
public String getWords() {
return words;
}
public void setWords(String words) {
this.words = words;
}
public Date getPrintDate() {
return printDate;
}
public void setPrintDate(Date printDate) {
this.printDate = printDate;
}
public String getKb() {
return kb;
}
public void setKb(String kb) {
this.kb = kb;
}
public String getPaper() {
return 易做图;
}
public void setPaper(String 易做图) {
this.易做图 = 易做图;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getPakage() {
return pakage;
}
public void setPakage(String pakage) {
this.pakage = pakage;
}
public int getPjCnt() {
return pjCnt;
}
public void setPjCnt(int pjCnt) {
this.pjCnt = pjCnt;
}
public int getBuyCnt() {
return buyCnt;
}
public void setBuyCnt(int buyCnt) {
this.buyCnt = buyCnt;
}
}
报错信息如下:
[javac] D:\worksapce4-android\DMServ\src\com\greatmay\model\Book.java:54: 非法的表达式开始
[javac] })
[javac] ^ ant 脚本 java
补充:Java , Java EE