<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    探討Java技術,努力學習,分享心得

    我不是技術控,拿來主義其實也挺好,但是一定要有自己的想法

    統計

    留言簿

    閱讀排行榜

    評論排行榜

    2015年2月10日 #

    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 瞿祥軍 閱讀(643) | 評論 (0)編輯 收藏

    2015年2月9日 #

    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 瞿祥軍 閱讀(42446) | 評論 (1)編輯 收藏

    2015年2月5日 #

    關于ThreadLocal的使用要求


    針對ThreadLocal的使用,如果在ThreadPool的場景中,線程的使用會存在覆蓋的問題;這里記錄下,后補場景demo。

    posted @ 2015-02-05 19:40 瞿祥軍 閱讀(303) | 評論 (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 瞿祥軍 閱讀(2292) | 評論 (0)編輯 收藏

    2015年2月4日 #

    Drools中文亂碼解決

         項目中用到了規則引擎,后來選用了drools開源的實現,后來部署的linux環境后亂碼,在本地不亂碼,所以第一時間就想到了應該是drools內部取了操作系統默認的編碼了 。凡是亂碼基本上是字節和字符之間相互轉換的時候出現的,經過仔細排查,發現將規則文件加入到session里面的時候沒有給編碼,于是加上。

    加載規則文件的時候必須指定編碼,比如UTF-8
    中文亂碼代碼:

    Reader reader = new FileReader(new File("F:/WorkFolder/drools/drl/addpoint.drl"));
    解決方法:
    Reader reader = new InputStreamReader(new FileInputStream("F:/WorkFolder/drools/drl/addpoint.drl"),"UTF-8");

    加上這一處編碼還是不行,后來發現我們用的decisiontable的解碼是用的jxl,在網上看,jxl的解析也有可能產生亂碼,于是加上:
    給容器啟動的時候設置jxl的編碼
    System.setProperty("jxl.encoding", "UTF-8");

    加上這兩個系統參數,也是亂碼,經過調試發現,org.drools.rule.builder.dialect.java.JavaDialect類里面的addClassCompileTask方法有將字符超字節轉換的代碼,如下:
    public void addClassCompileTask(final String className,
                                         final BaseDescr descr,
                                         final String text,
                                         final MemoryResourceReader src,
                                         final ErrorHandler handler) {

            final String fileName = className.replace( '.',
                                                       '/' ) + ".java";
            try {
            if (src != null) {
                     src.add( fileName,
                              text.getBytes() );
                 } else {
                     this.src.add( fileName,
                                   text.getBytes() );
                 }
            } catch (final UnsupportedEncodingException e ) {
               throw new RuntimeException("unable to encoding the rule!");
            }
           

            this.errorHandlers.put( fileName,
                                    handler );

            addClassName( fileName );
        }

    我們再來看一下String的getBytes方法的實現,這個方法里面默認取平臺的編碼的,至此,我們就知道病根了,所以比較簡單了,加上-Dfile.encoding=UTF8參數就可以了。注意,這個地方是UTF8,不是UTF-8,具體的解釋看官方文檔: http://docs.oracle.com/javase/6/docs/technotes/guides/intl/encoding.doc.html,最后這個也是在tomcat的啟動參數里面加上-Dfile.encoding=UTF8
    • 在tomcat的啟動
      catalina.bat/
      catalina.sh
      參數里面加上-Dfile.encoding=UTF8

    CATALINA_OPTS="-Xmx1024m -Xms1024m -XX:PermSize=256m -XX:MaxPermSize=512m -Xss128k -server -Xdebug -Xnoagent -Djav

    a.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8530 -Dfile.encoding=UTF8"


    • 在maven跑junit測試的時候加上這個參數-Dfile.encoding=UTF-8
    如果不加這個測試,在junit跑測試的時候還會使用操作系統的默認字符集,會導致測試失敗:
                              <plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <groupId>org.apache.maven.plugins</groupId>
    <version>2.11</version>
    <configuration>
    <argLine>-Dfile.encoding=utf-8</argLine>
    <parallel>methods</parallel>  
            <threadCount>10</threadCount>  
    <includes>
    <include>**/*Test.java</include>
    </includes>
    <excludes>
    <exclude>**/BaseControllerTest.java</exclude>
    <exclude>**/BaseTest.java</exclude>
    <exclude>**/TestUtils.java</exclude>
    </excludes>
    </configuration>
    </plugin>

    這里亂碼問題告一段落!





    posted @ 2015-02-04 15:22 瞿祥軍 閱讀(5561) | 評論 (2)編輯 收藏

    僅列出標題  
    主站蜘蛛池模板: 亚洲GV天堂无码男同在线观看| 久久亚洲精品成人AV| 免费国产叼嘿视频大全网站| 亚洲av无码专区在线观看素人| 在线观看亚洲网站| 国产美女无遮挡免费网站| 亚洲无码一区二区三区| 免费观看美女裸体网站| 国产亚洲视频在线| 国产亚洲色视频在线| 中文字幕成人免费高清在线| 国产亚洲精品资源在线26u| 免费一级毛片无毒不卡| 亚洲最大福利视频网站| 免费观看国产网址你懂的| 免费一看一级毛片| 无码人妻一区二区三区免费视频 | 亚洲欧洲av综合色无码| 在线观看无码的免费网站| 特级无码毛片免费视频| 久久久久亚洲精品无码网址| 精品国产麻豆免费人成网站| 亚洲欧洲国产精品久久| 成熟女人牲交片免费观看视频| 国产精品亚洲专区无码不卡| 久久久亚洲精品蜜桃臀| 999任你躁在线精品免费不卡| 亚洲av无码专区在线| 全黄性性激高免费视频| 国产黄在线播放免费观看| 久久精品国产亚洲av麻豆色欲| 9久9久女女免费精品视频在线观看| 亚洲AV无码一区二区三区性色 | 99久久亚洲精品无码毛片| 好爽…又高潮了毛片免费看| 日韩精品免费一线在线观看| 亚洲视频免费观看| 国产91精品一区二区麻豆亚洲| 在线观看免费av网站| 亚洲精品无码一区二区| 国产日韩亚洲大尺度高清|