探讨Java技术,努力学习,分享心得

我不是技术控,拿来主义其实也挺好,但是一定要有自己的想法

统计

留言簿

阅读排行榜

评论排行榜

2015年2月5日 #

Maven的工程目录结构

pom.xml 的参照模型

<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.brms.governor</groupId>
<artifactId>brms-governor</artifactId>
<version>0.9.0</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java-version>1.6</java-version>
<java-encoding>UTF-8</java-encoding>
<dpap-version>1.1.2</dpap-version>
<brms-server-version>0.9.0</brms-server-version>
<brms-governor-version>0.9.0</brms-governor-version>
<wro4j-version>1.6.3</wro4j-version>
<wro4j-minimize>false</wro4j-minimize>
<mybatis-version>3.0.5</mybatis-version>
<mybatis-spring-version>1.0.1</mybatis-spring-version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.brms.server</groupId>
<artifactId>brms-server-base</artifactId>
<version>${brms-server-version}</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.1.0</version>
<exclusions>
<exclusion>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.1.1.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>oracle</groupId>
<artifactId>oracle-jdbc</artifactId>
<version>10.1.0.2.0</version>
<scope>test</scope>
</dependency>
<!-- mybatis 坐标 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis-version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${mybatis-spring-version}</version>
</dependency>
<!-- DPAP framework start -->
<dependency>
<groupId>com</groupId>
<artifactId>framework-shared</artifactId>
<version>${dpap-version}</version>
</dependency>
<dependency>
<groupId>com</groupId>
<artifactId>framework-server</artifactId>
<version>${dpap-version}</version>
<exclusions>
<exclusion>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com</groupId>
<artifactId>framework-sso</artifactId>
<version>${dpap-version}</version>
</dependency>
<dependency>
<groupId>org.lazyluke</groupId>
<artifactId>log4jdbc-remix</artifactId>
<version>0.2.7</version>
</dependency>
<!-- DPAP framework end -->
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<id>releases</id>
<name>release repository</name>
<url>http://私服:端口/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>snapshot repository</name>
<url>http://私服:端口/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<versionRange>[1.6.0,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<version>${wro4j-version}</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<minimize>${wro4j-minimize}</minimize>
<extraConfigFile>${basedir}/src/main/resources/com/module/${moduleContext}/server/META-INF/wro.properties</extraConfigFile>
<wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
<cssDestinationFolder>${project.build.directory}/classes/com/module/${moduleContext}/server/META-INF/styles/wro/</cssDestinationFolder>
<jsDestinationFolder>${project.build.directory}/classes/com/module/${moduleContext}/server/META-INF/scripts/wro/</jsDestinationFolder>
<wroFile>${basedir}/src/main/resources/com/module/${moduleContext}/server/META-INF/wro.xml</wroFile>
<groupNameMappingFile>${project.build.directory}/classes/com/module/${moduleContext}/server/META-INF/wromapping.properties</groupNameMappingFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<attach>true</attach>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
<encoding>${java-encoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dev</id>
<properties>
<staticServer>http://静态资源服务器/dpap/dpap</staticServer>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>WEB-INF/web.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>normal</id>
<properties>
<staticServer>http://静态资源服务器/dpap/dpap</staticServer>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>WEB-INF/web.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>sit</id>
<properties>
<staticServer>http://静态资源服务器/dpap/dpap</staticServer>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>WEB-INF/web.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>prd</id>
<properties>
<staticServer>http://静态资源服务器/dpap/foss</staticServer>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>WEB-INF/web.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<modules>
<module>common-login</module>
<module>common-sysconfig</module>
<module>common-frameworkimpl</module>
<module>common-dict</module>
<module>common-monitor</module>
<module>common-message</module>
<module>common-sync</module>
<module>common-authorization</module>
</modules>
</project>

posted @ 2015-02-10 17:07 瞿祥军 阅读(626) | 评论 (0)编辑 收藏

Maven依赖编译出现异常,以及解决思路


Maven项目的 
<modules>
<module>common-login</module>
<module>common-sysconfig</module>
<module>common-frameworkimpl</module>
<module>common-dict</module>
<module>common-monitor</module>
<module>common-message</module>
<module>common-sync</module>
<module>common-authorization</module>
</modules>
各个模块的依赖关系,在完成整体模块编译之前,需要各个module全部install完成,而且各个需求在maven版本下,存在对应的jar包;

如果按照依赖顺序,先编译成功全部的子module,然后在编译对应的parent工程。

Maven编译出错信息:

Apache Maven 3.0.2 (r1056850; 2011-01-09 08:58:10+0800)
Java version: 1.6.0_25, vendor: Sun Microsystems Inc.
Java home: C:\jdk\jdk1.6.0_25\jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from EMBEDDED\conf\settings.xml
[DEBUG] Reading user settings from d:\232750\.m2\settings.xml
[DEBUG] Using local repository at D:\232750\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for D:\232750\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.deppon.dpap.brms.governor:brms-governor-web:war:0.9.0: (none)
[DEBUG] Looking up lifecyle mappings for packaging war from ClassRealm[plexus.core, parent: null]
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.deppon.dpap.brms.governor:brms-governor-web:war:0.9.0
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-war-plugin is missing. @ com.deppon.dpap.brms.governor:brms-governor:0.9.0, F:\juny.qu\rule_workspace\brms-governor\pom.xml, line 245, column 14
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: com.deppon.dpap.brms.governor:brms-governor-web:war:0.9.0
[DEBUG] Tasks:   [install]
[DEBUG] Style:   Regular
[DEBUG] =======================================================================
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building brms-governor-web 0.9.0
[INFO] ------------------------------------------------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project:       com.deppon.dpap.brms.governor:brms-governor-web:0.9.0
[DEBUG] Dependencies (collect): []
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources (default-resources)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <buildFilters default-value="${project.build.filters}"/>
  <encoding default-value="${project.build.sourceEncoding}">${encoding}</encoding>
  <escapeString default-value="${maven.resources.escapeString}"/>
  <escapeWindowsPaths default-value="true">${maven.resources.escapeWindowsPaths}</escapeWindowsPaths>
  <includeEmptyDirs default-value="false">${maven.resources.includeEmptyDirs}</includeEmptyDirs>
  <outputDirectory default-value="${project.build.outputDirectory}"/>
  <overwrite default-value="false">${maven.resources.overwrite}</overwrite>
  <project default-value="${project}"/>
  <resources default-value="${project.resources}"/>
  <session default-value="${session}"/>
  <useBuildFilters default-value="true"/>
  <useDefaultDelimiters default-value="true"/>
</configuration>
[DEBUG] =======================================================================
[DEBUG] com.deppon.dpap.brms.governor:brms-governor-web:war:0.9.0
[DEBUG]    com.deppon.dpap:framework-server:jar:1.1.2:compile
[DEBUG]       com.deppon.dpap:framework-shared:jar:1.1.2:compile
[DEBUG]          com.caucho:hessian:jar:4.0.7:compile
[DEBUG]       org.springframework:spring-core:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-context:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-aspects:jar:3.0.5.RELEASE:compile
[DEBUG]          org.springframework:spring-context-support:jar:3.0.5.RELEASE:compile
[DEBUG]          org.springframework:spring-test:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-instrument:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-jdbc:jar:3.0.5.RELEASE:compile
[DEBUG]          org.springframework:spring-tx:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-jms:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-orm:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-oxm:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-web:jar:3.0.5.RELEASE:compile
[DEBUG]       org.springframework:spring-webmvc:jar:3.0.5.RELEASE:compile
[DEBUG]       aopalliance:aopalliance:jar:1.0:compile
[DEBUG]       org.aspectj:aspectjweaver:jar:1.6.8:compile
[DEBUG]       cglib:cglib-nodep:jar:2.2:compile
[DEBUG]       org.apache.struts:struts2-core:jar:2.3.15.1:compile
[DEBUG]          org.apache.struts.xwork:xwork-core:jar:2.3.15.1:compile
[DEBUG]             asm:asm:jar:3.3:compile
[DEBUG]             asm:asm-commons:jar:3.3:compile
[DEBUG]                asm:asm-tree:jar:3.3:compile
[DEBUG]          org.freemarker:freemarker:jar:2.3.19:compile
[DEBUG]          ognl:ognl:jar:3.0.6:compile
[DEBUG]          commons-fileupload:commons-fileupload:jar:1.3:compile
[DEBUG]       org.apache.struts:struts2-spring-plugin:jar:2.3.15.1:compile
[DEBUG]          org.apache.commons:commons-lang3:jar:3.1:compile
[DEBUG]       org.apache.struts:struts2-convention-plugin:jar:2.3.15.1:compile
[DEBUG]       commons-beanutils:commons-beanutils:jar:1.8.3:compile
[DEBUG]       commons-lang:commons-lang:jar:2.6:compile
[DEBUG]       commons-collections:commons-collections:jar:3.2.1:compile
[DEBUG]       commons-codec:commons-codec:jar:1.5:compile
[DEBUG]       commons-io:commons-io:jar:2.0.1:compile
[DEBUG]       commons-logging:commons-logging:jar:1.1.1:compile
[DEBUG]       commons-configuration:commons-configuration:jar:1.6:compile
[DEBUG]          commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[DEBUG]       commons-digester:commons-digester:jar:2.1:compile
[DEBUG]       commons-pool:commons-pool:jar:1.5.6:compile
[DEBUG]       commons-dbcp:commons-dbcp:jar:1.4:compile
[DEBUG]       commons-dbutils:commons-dbutils:jar:1.3:compile
[DEBUG]       org.mybatis:mybatis:jar:3.0.5:compile
[DEBUG]       org.mybatis:mybatis-spring:jar:1.0.1:compile
[DEBUG]       javax.transaction:transaction-api:jar:1.1:compile
[DEBUG]       org.quartz-scheduler:quartz:jar:1.8.6:compile
[DEBUG]       org.quartz-scheduler:quartz-oracle:jar:1.8.6:compile
[DEBUG]       log4j:log4j:jar:1.2.16:compile
[DEBUG]       org.slf4j:slf4j-log4j12:jar:1.6.1:compile
[DEBUG]       org.slf4j:slf4j-api:jar:1.6.1:compile
[DEBUG]       org.codehaus.jackson:jackson-core-asl:jar:1.8.1:compile
[DEBUG]       org.codehaus.jackson:jackson-mapper-asl:jar:1.8.1:compile
[DEBUG]       javax.mail:mail:jar:1.4.1:compile
[DEBUG]       javax.activation:activation:jar:1.0.2:compile
[DEBUG]       javassist:javassist:jar:3.12.1.GA:compile
[DEBUG]       org.jgroups:jgroups:jar:3.0.10.Final:compile
[DEBUG]       redis.clients:jedis:jar:2.1.0:compile
[DEBUG]       com.alibaba:fastjson:jar:1.1.35:compile
[DEBUG]       org.apache.poi:poi:jar:3.8:compile
[DEBUG]       org.apache.poi:poi-ooxml:jar:3.8:compile
[DEBUG]          dom4j:dom4j:jar:1.6.1:compile
[DEBUG]             xml-apis:xml-apis:jar:1.0.b2:compile
[DEBUG]       org.apache.poi:poi-ooxml-schemas:jar:3.8:compile
[DEBUG]          org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[DEBUG]             stax:stax-api:jar:1.0.1:compile
[DEBUG]       org.codehaus.groovy:groovy-all:jar:1.7.5:compile
[DEBUG]       com.lowagie:itext:jar:2.1.7:compile
[DEBUG]          bouncycastle:bcmail-jdk14:jar:138:compile
[DEBUG]          bouncycastle:bcprov-jdk14:jar:138:compile
[DEBUG]          org.bouncycastle:bctsp-jdk14:jar:1.38:compile
[DEBUG]             org.bouncycastle:bcprov-jdk14:jar:1.38:compile
[DEBUG]             org.bouncycastle:bcmail-jdk14:jar:1.38:compile
[DEBUG]       com.lowagie:iTextAsian:jar:2.1.7:compile
[DEBUG]       org.mongodb:mongo-java-driver:jar:2.9.3:compile
[DEBUG]       commons-net:commons-net:jar:3.2:compile
[DEBUG]       org.apache.ant:ant:jar:1.8.4:compile
[DEBUG]          org.apache.ant:ant-launcher:jar:1.8.4:compile
[DEBUG]    com.deppon.dpap.brms.governor:brms-governor-config:jar:0.9.0:compile
[DEBUG]    com.deppon.dpap.brms.governor:brms-governor-common:jar:0.9.0:compile
[DEBUG]       com.deppon.dpap.brms.server:brms-server-base:jar:0.9.0:compile
[DEBUG]       com.deppon.dpap:framework-sso:jar:1.1.2:compile
[DEBUG]    com.deppon.dpap.brms.governor:brms-governor-ruleeditor:jar:0.9.0:compile
[DEBUG]    com.deppon.dpap.brms.governor:brms-governor-rulemanage:jar:0.9.0:compile
[DEBUG]       com.deppon.dpap.brms.governor:common-dict:jar:0.9.0:compile
[DEBUG]          com.deppon.dpap.brms.governor:common-frameworkimpl:jar:0.9.0:compile
[DEBUG]       com.deppon.dpap.brms.governor:common-login:jar:0.9.0:compile
[DEBUG]          com.deppon.dpap.brms.governor:common-authorization:jar:0.9.0:compile
[DEBUG]          com.deppon.dpap.brms.governor:common-message:jar:0.9.0:compile
[DEBUG]          com.deppon.dpap.brms.governor:common-sync:jar:0.9.0:compile
[DEBUG]             com.ibm.mq:commonservices:jar:1.0:compile
[DEBUG]             com.ibm.mq:dhbcore:jar:1.0:compile
[DEBUG]             com.ibm.mq:fscontext:jar:1.0:compile
[DEBUG]             com.ibm.mq:headers:jar:1.0:compile
[DEBUG]             com.ibm.mq:jmqi:jar:1.0:compile
[DEBUG]             com.ibm.mq:jms:jar:1.0:compile
[DEBUG]             com.ibm.mq:jta:jar:1.0:compile
[DEBUG]             com.ibm.mq:mq:jar:1.0:compile
[DEBUG]             com.ibm.mq:mqjms:jar:1.0:compile
[DEBUG]             com.ibm.mq:pcf:jar:1.0:compile
[DEBUG]             com.ibm.mq:providerutil:jar:1.0:compile
[DEBUG]          com.deppon.dpap.brms.governor:common-sysconfig:jar:0.9.0:compile
[DEBUG]          com.deppon.dpap.brms.governor:common-monitor:jar:0.9.0:compile
[DEBUG]          com.deppon.casclient:casclient:jar:2.1.1:compile
[DEBUG]    com.deppon.dpap.brms.governor:brms-governor-monitor:jar:0.9.0:compile
[DEBUG]    oracle:oracle-jdbc:jar:10.1.0.2.0:compile
[DEBUG]    javax.servlet:servlet-api:jar:2.5:provided
[DEBUG]    javax.servlet:jsp-api:jar:2.0:provided
[DEBUG]    org.lazyluke:log4jdbc-remix:jar:0.2.7:compile
[DEBUG]       junit:junit:jar:4.8.2:test (scope managed from compile) (version managed from 4.7)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.796s
[INFO] Finished at: Mon Feb 09 16:52:45 CST 2015
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project brms-governor-web: Could not resolve dependencies for project com.deppon.dpap.brms.governor:brms-governor-web:war:0.9.0: Failure to find com.deppon.dpap.brms.governor:brms-governor-monitor:jar:0.9.0 in http://私服地址:端口/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project brms-governor-web: Could not resolve dependencies for project com.deppon.dpap.brms.governor:brms-governor-web:war:0.9.0: Failure to find com.deppon.dpap.brms.governor:brms-governor-monitor:jar:0.9.0 in http://私服地址:端口/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:190)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:104)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:258)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:201)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.deppon.dpap.brms.governor:brms-governor-web:war:0.9.0: Failure to find com.deppon.dpap.brms.governor:brms-governor-monitor:jar:0.9.0 in http://私服地址:端口/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:156)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:165)
... 22 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Failure to find com.deppon.dpap.brms.governor:brms-governor-monitor:jar:0.9.0 in http://私服地址:端口/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:526)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveArtifacts(DefaultRepositorySystem.java:304)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:334)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:150)
... 23 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Failure to find com.deppon.dpap.brms.governor:brms-governor-monitor:jar:0.9.0 in http://私服地址:端口/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced
at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:186)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:408)
... 26 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

posted @ 2015-02-09 17:09 瞿祥军 阅读(42367) | 评论 (1)编辑 收藏

关于ThreadLocal的使用要求


针对ThreadLocal的使用,如果在ThreadPool的场景中,线程的使用会存在覆盖的问题;这里记录下,后补场景demo。

posted @ 2015-02-05 19:40 瞿祥军 阅读(296) | 评论 (0)编辑 收藏

在drools引擎中如果使用规则表

前提准备:java 虚拟机 
                 Drools核心库
                 Junit4.0以上版本
                 规则Excel模板表(将下面的图片的内容新建到Excel中)

典型的用法就是根据excel创建KnowledgeBase,然后将它丢给session执行,执行的参数和结果都在params里面
  1 package com.xxx.yyyy;
  2 
  3 import java.io.File;
  4 import java.io.FileInputStream;
  5 import java.io.InputStream;
  6 import java.util.Arrays;
  7 import java.util.Collection;
  8 import java.util.HashMap;
  9 import java.util.Map;
 10 import junit.framework.Assert;
 11 import org.drools.KnowledgeBase;
 12 import org.drools.KnowledgeBaseFactory;
 13 import org.drools.builder.DecisionTableConfiguration;
 14 import org.drools.builder.DecisionTableInputType;
 15 import org.drools.builder.KnowledgeBuilder;
 16 import org.drools.builder.KnowledgeBuilderFactory;
 17 import org.drools.builder.ResourceType;
 18 import org.drools.definition.KnowledgePackage;
 19 import org.drools.io.ResourceFactory;
 20 import org.drools.runtime.StatelessKnowledgeSession;
 21 import org.junit.Test;
 22 import org.junit.runner.RunWith;
 23 import org.junit.runners.Parameterized;
 24 import org.junit.runners.Parameterized.Parameters;
 25 
 26 @RunWith(Parameterized.class)
 27 public class IsP4PTest
 28 {
 29     private IsP4P param;
 30 
 31     private String extected;
 32 
 33     public IsP4PTest(IsP4P param, String extected)
 34     {
 35         this.param = param;
 36         this.extected = extected;
 37     }
 38 public Map<String, Object> getParams()
 39         {
 40             Map<String, Object> params = new HashMap<String, Object>();
 41 
 42             params.put("productLine", productLine);
 43             params.put("productType", productType);
 44             params.put("playType", playType);
 45 
 46             return params;
 47         }
 48 public void testExcel(String fileName, Map<String, Object> params)
 49             throws Exception
 50     {
 51         System.out.println("---------------begin------------------------");
 52 
 53         DecisionTableConfiguration dtableconfiguration = KnowledgeBuilderFactory
 54                 .newDecisionTableConfiguration();
 55 dtableconfiguration.setInputType(DecisionTableInputType.XLS);
 56         final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
 57                 .newKnowledgeBuilder();
 58 File file = new File(
 59                 "F:\\juny.qu\\rule_workspace\\com.deppon.rules\\src\\main\\java\\com\\xxx\\yyyy\\"
 60                         + fileName);
 61         InputStream is = new FileInputStream(file);
 62 kbuilder.add(ResourceFactory.newInputStreamResource(is, "UTF-8"),
 63                 ResourceType.DTABLE);
 64         if (kbuilder.hasErrors())
 65         {
 66             System.out.println(kbuilder.getErrors().toString());
 67         }
 68 Collection<KnowledgePackage> pkgs = kbuilder.getKnowledgePackages();
 69         KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
 70         kbase.addKnowledgePackages(pkgs);
 71 
 72 StatelessKnowledgeSession ksession = kbase
 73                 .newStatelessKnowledgeSession();
 74         ksession.execute(Arrays.asList(new Object[] { params }));
 75 
 76 System.out.println("---------------end------------------------");
 77 }
 78 
 79 
 80 @Parameters
 81     public static Collection<?> contructData()
 82     {
 83 return Arrays.asList(new Object[][] {
 84                 { new IsP4P("搜索推广", "true", "null"), "true" },
 85                 { new IsP4P("网盟推广", "true", "null"), "true" },
 86                 { new IsP4P("掘金推广", "true", "非轮播"), "false" },
 87                 { new IsP4P("其他", "false", "其他"), "other" } });
 88 }
 89 
 90 @Test
 91     public void testP4P() throws Exception
 92     {
 93         Map<String, Object> params = new HashMap<String, Object>();
 94         params.putAll(param.getParams());
 95         testExcel("ka/isP4P.xls", params);
 96         Assert.assertEquals(extected, params.get("isP4P"));
 97     }
 98 }
 99 
100 

 1 package com.xxx.yyyy;
 2 
 3 import java.io.File;
 4 import java.io.FileInputStream;
 5 import java.io.FileNotFoundException;
 6 import java.io.InputStream;
 7 
 8 import org.drools.decisiontable.InputType;
 9 import org.drools.decisiontable.SpreadsheetCompiler;
10 import org.junit.Test;
11 
12 public class SpreadsheetCompilerTest {
13 
14 @Test
15     public void compile() throws FileNotFoundException{
16         //File file = new File("F:\\juny.qu\\rule_workspace\\com.deppon.rules\\src\\main\\java\\com\\xxx\\yyyy\\ka\\isP4P.xls");
17         //File file = new File("F:\\collections_study\\规则引擎系统开发小组\\规则引擎doc\\02开发\\06-详细设计\\增值服务折扣测试1.xls");
18         File file = new File("F:\\rules.xlsx");
19         
20         InputStream is = new FileInputStream(file);
21         
22         SpreadsheetCompiler converter = new SpreadsheetCompiler();
23         String drl = converter.compile(is, InputType.XLS); //--------exception here-------- 
24         System.out.println("\n\n" + drl);
25         
26     }
27 
28 }
  • 什么时候考虑使用规则表
  如果规则可以表示成 templates+data(模板+数据),可以考虑使用 decision tables。在决策表的每一行,采集数据和模板一起生成规则。使用基于决策表的SpreadsheetAPIDrools-decisiontables模块中。只有一个类:SpreadsheetCompiler. 这个类可以操作各种格式的Spreadsheet,并生成DRL规则(然后就可以常规的方式使用)。

一个典型的规则表的格式




posted @ 2015-02-05 14:09 瞿祥军 阅读(2287) | 评论 (0)编辑 收藏