[ 
https://issues.apache.org/jira/browse/DBUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759600#comment-17759600
 ] 

mark commented on DBUTILS-151:
------------------------------

Saving the file seems pointless if the configuration is not part of the project.

Adding the following override configuration (bold part) for the moditect plugin 
resolves the problem
 
{{<profile>}}
{{  <id>moditect</id>}}
{{  <activation>}}
{{    <jdk>[9,)</jdk>}}
{{  </activation>}}
{{  <properties>}}
{{    <moditect.java.version>9</moditect.java.version>}}
{{  </properties>}}
{{  <build>}}
{{    <plugins>}}
{{      <plugin>}}
{{        <groupId>org.moditect</groupId>}}
{{        <artifactId>moditect-maven-plugin</artifactId>}}
{{        <version>${commons.moditect-maven-plugin.version}</version>}}
{{        <executions>}}
{{          <execution>}}
{{            <id>add-module-infos</id>}}
{{            <phase>package</phase>}}
{{            <goals>}}
{{              <goal>add-module-info</goal>}}
{{            </goals>}}
{{            <configuration>}}
{{              <jvmVersion>${moditect.java.version}</jvmVersion>}}
{{              <jdepsExtraArgs>}}
{{                <arg>--multi-release=${moditect.java.version}</arg>}}
{{              </jdepsExtraArgs>}}
{{              <outputDirectory>${project.build.directory}</outputDirectory>}}
{{              <overwriteExistingFiles>true</overwriteExistingFiles>}}
{{              <failOnWarning>false</failOnWarning>}}
{{              <module>}}
{{                <moduleInfo>}}
{{                  <name>${commons.module.name}</name>}}
{{                  
*<uses>org.apache.commons.dbutils.ColumnHandler;org.apache.commons.dbutils.PropertyHandler</uses>*}}
{{                </moduleInfo>}}
{{              </module>}}
{{            </configuration>}}
{{          </execution>}}
{{        </executions>}}
{{      </plugin>}}
{{    </plugins>}}
{{  </build>}}
{{</profile>}}
 
as the generates the required {{uses}} clauses, it's possible that this could 
also be achieved using the {{-Dmoditect.addServiceUses=true}} commandline 
option; however that would make things even less transparent

> module org.apache.commons.dbutils does not declare `uses`
> ---------------------------------------------------------
>
>                 Key: DBUTILS-151
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-151
>             Project: Commons DbUtils
>          Issue Type: Bug
>    Affects Versions: 1.8.0
>         Environment: openjdk version "11.0.20" 2023-07-18 / Maven 3.9.4
>            Reporter: mark
>            Priority: Major
>
> On upgrading an existing project from 1.7 (using "auto-module") to 1.8.0 I'm 
> seeing ServiceConfigurationError errors in some testcases that point to the 
> newly added module configuration/module-info.class (which btw does not appear 
> to be in the change list and not in the source code)
>  
> {{{}[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 
> 0.076 s <<< FAILURE! -- in 
> nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest{}}}{{{}[ERROR] 
> nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest.checkLimitQuery -- 
> Time elapsed: 0.043 s <<< ERROR!{}}}{{{}java.util.ServiceConfigurationError: 
> org.apache.commons.dbutils.ColumnHandler: module org.apache.commons.dbutils 
> does not declare `uses`{}}}{{        at 
> java.base/java.util.ServiceLoader.fail(ServiceLoader.java:589)}}{{        at 
> java.base/java.util.ServiceLoader.checkCaller(ServiceLoader.java:575)}}{{     
>    at java.base/java.util.ServiceLoader.<init>(ServiceLoader.java:504)}}{{    
>     at java.base/java.util.ServiceLoader.load(ServiceLoader.java:1692)}}{{    
>     at 
> [email protected]/org.apache.commons.dbutils.BeanProcessor.<clinit>(BeanProcessor.java:83)}}{{
>         at 
> [email protected]/org.apache.commons.dbutils.BasicRowProcessor.<clinit>(BasicRowProcessor.java:135)}}{{
>         at 
> [email protected]/org.apache.commons.dbutils.handlers.ArrayHandler.<clinit>(ArrayHandler.java:40)}}{{
>         at 
> [email protected]/org.apache.commons.dbutils.handlers.MapListHandler.<init>(MapListHandler.java:45)}}{{
>         at 
> [email protected]/nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest.checkLimitQuery(LimitSqlOracleIntegrationTest.java:68)}}{{
>         at java.base/java.lang.reflect.Method.invoke(Method.java:566)}}{{     
>    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)}}{{        
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)}}
> {{{}[ERROR] 
> nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest.checkLimitQueryOracle11
>  -- Time elapsed: 0.029 s <<< ERROR!{}}}{{{}java.lang.NoClassDefFoundError: 
> Could not initialize class 
> org.apache.commons.dbutils.handlers.ArrayHandler{}}}{{        at 
> [email protected]/org.apache.commons.dbutils.handlers.MapListHandler.<init>(MapListHandler.java:45)}}{{
>         at 
> [email protected]/nl.b3p.jdbc.util.converter.LimitSqlOracleIntegrationTest.checkLimitQueryOracle11(LimitSqlOracleIntegrationTest.java:99)}}{{
>         at java.base/java.lang.reflect.Method.invoke(Method.java:566)}}{{     
>    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)}}{{        
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)}}
>  
>  
> eg 
> [https://github.com/B3Partners/jdbc-util/actions/runs/5808228462/job/15774473973#step:8:247]
>  on PR: https://github.com/B3Partners/jdbc-util/pull/478



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to