我有
通过Maven和Hudson
这是我的 pom.xml
[...]
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>mypk.monitoring.jmx.bind</packageName>
<outputDirectory>${basedir}/src/generated-sources</outputDirectory>
<schemaDirectory>${basedir}/src/main/resources</schemaDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
[...]
这里是结果
[artifact:mvn] [INFO] Generating source...
[artifact:mvn] [INFO] parsing a schema...
[artifact:mvn] [INFO] compiling a schema...
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/ApplicationRuntimeType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/ApplicationType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/ClusterType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/DomainType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/EJBType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/JDBCDataSourceType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/JDBCOracleDataSourceType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/JMSModuleType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/JMSServerType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/JMSType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/MDBType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/ModuleType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/ObjectFactory.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/ObjectType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/ProbesType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/QueueType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/ResourceType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/ServerType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/TypeType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/WorkManagerType.java
[artifact:mvn] [INFO] mypck/monitoring/jmx/bind/package-info.java
[artifact:mvn] [INFO]
---产生了源---
[artifact:mvn] [INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) @ scol-krn-jmxprobe-jar ---
[artifact:mvn] [INFO] Source directory: /ws/scol-krn-jmxprobe-jar/src/generated-sources added.
[artifact:mvn] [INFO]
[artifact:mvn] [INFO] --- jaxb2-maven-plugin:1.3:xjc (default) @ scol-krn-jmxprobe-jar ---
[artifact:mvn] [INFO] No changes detected in schema or binding files, skipping source generation.
[artifact:mvn] [INFO]
[artifact:mvn] [INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) @ scol-krn-jmxprobe-jar ---
[artifact:mvn] [INFO] Source directory: /ws/scol-krn-jmxprobe-jar/src/generated-sources added.
---增加了源头目录-----
[artifact:mvn] [INFO] -------------------------------------------------------------
[artifact:mvn] [ERROR] COMPILATION ERROR :
[artifact:mvn] [INFO] -------------------------------------------------------------
[artifact:mvn] [ERROR] [...] MDBVisitor.java:[64,7] error: cannot find symbol
[artifact:mvn]
[artifact:mvn] [ERROR] variable mdb of type MDBType
[artifact:mvn] [...] MDBVisitor.java:[72,7] error: cannot find symbol
Maven版本3.1.2。 从命令行正常工作!!!
答案 0 :(得分:0)
删除行
<outputDirectory>${basedir}/src/generated-sources</outputDirectory>
删除插件
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
有时Hudson无法添加自定义源....我不知道为什么!