Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: support Java Platform Module System#618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
alaahong wants to merge4 commits intoapache:main
base:main
Choose a base branch
Loading
fromalaahong:feature/java_module
Draft
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletionsfesod/pom.xml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -174,4 +174,79 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>java9-modules</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<properties>
<surefire.jdk9plus.args>
--add-opens org.apache.poi.ooxml/org.apache.poi.xssf.streaming=org.apache.fesod
--add-opens org.apache.poi.ooxml/org.apache.poi.xssf.usermodel=org.apache.fesod
--add-opens org.apache.poi.ooxml/org.apache.poi.xssf.usermodel.helpers=org.apache.fesod
--add-opens org.apache.poi.ooxml/org.apache.poi.openxml4j.opc.internal=org.apache.fesod
--add-opens org.apache.poi.poi/org.apache.poi.hssf.usermodel=org.apache.fesod
--add-opens java.base/sun.reflect.annotation=org.apache.fesod
</surefire.jdk9plus.args>
<maven.test.skip>false</maven.test.skip>
<skipTests>false</skipTests>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- keep main source at 1.8; only module-info compiled via execution below -->
<testRelease>9</testRelease>
</configuration>
<executions>
<execution>
<id>compile-module-info</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
</compileSourceRoots>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>add-java9-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/src/test/java9</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useModulePath>true</useModulePath>
<argLine>${surefire.jvm.args} ${surefire.jdk9plus.args} ${argLine}</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
112 changes: 112 additions & 0 deletionsfesod/src/main/java9/module-info.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

open module org.apache.fesod {
requires java.base;
requires java.logging;
requires java.xml;
requires java.sql;

requires org.apache.commons.collections4;
requires org.apache.commons.compress;
requires org.apache.commons.csv;
requires org.apache.commons.io;
requires org.apache.poi.ooxml;
requires org.apache.poi.ooxml.schemas;
requires org.apache.poi.poi;
requires org.apache.xmlbeans;
requires fastexcel.support;
requires ehcache;
requires org.slf4j;

requires static lombok;

exports org.apache.fesod.excel;
exports org.apache.fesod.excel.analysis;
exports org.apache.fesod.excel.analysis.csv;
exports org.apache.fesod.excel.analysis.v03;
exports org.apache.fesod.excel.analysis.v03.handlers;
exports org.apache.fesod.excel.analysis.v07;
exports org.apache.fesod.excel.analysis.v07.handlers;
exports org.apache.fesod.excel.analysis.v07.handlers.sax;
exports org.apache.fesod.excel.annotation;
exports org.apache.fesod.excel.annotation.format;
exports org.apache.fesod.excel.annotation.write.style;
exports org.apache.fesod.excel.cache;
exports org.apache.fesod.excel.cache.selector;
exports org.apache.fesod.excel.constant;
exports org.apache.fesod.excel.context;
exports org.apache.fesod.excel.context.csv;
exports org.apache.fesod.excel.context.xls;
exports org.apache.fesod.excel.context.xlsx;
exports org.apache.fesod.excel.converters;
exports org.apache.fesod.excel.converters.bigdecimal;
exports org.apache.fesod.excel.converters.biginteger;
exports org.apache.fesod.excel.converters.booleanconverter;
exports org.apache.fesod.excel.converters.bytearray;
exports org.apache.fesod.excel.converters.byteconverter;
exports org.apache.fesod.excel.converters.date;
exports org.apache.fesod.excel.converters.doubleconverter;
exports org.apache.fesod.excel.converters.file;
exports org.apache.fesod.excel.converters.floatconverter;
exports org.apache.fesod.excel.converters.inputstream;
exports org.apache.fesod.excel.converters.integer;
exports org.apache.fesod.excel.converters.localdate;
exports org.apache.fesod.excel.converters.localdatetime;
exports org.apache.fesod.excel.converters.longconverter;
exports org.apache.fesod.excel.converters.shortconverter;
exports org.apache.fesod.excel.converters.string;
exports org.apache.fesod.excel.converters.url;
exports org.apache.fesod.excel.enums;
exports org.apache.fesod.excel.enums.poi;
exports org.apache.fesod.excel.event;
exports org.apache.fesod.excel.exception;
exports org.apache.fesod.excel.metadata;
exports org.apache.fesod.excel.metadata.csv;
exports org.apache.fesod.excel.metadata.data;
exports org.apache.fesod.excel.metadata.format;
exports org.apache.fesod.excel.metadata.property;
exports org.apache.fesod.excel.read.builder;
exports org.apache.fesod.excel.read.listener;
exports org.apache.fesod.excel.read.metadata;
exports org.apache.fesod.excel.read.metadata.holder;
exports org.apache.fesod.excel.read.metadata.holder.csv;
exports org.apache.fesod.excel.read.metadata.holder.xls;
exports org.apache.fesod.excel.read.metadata.holder.xlsx;
exports org.apache.fesod.excel.read.metadata.property;
exports org.apache.fesod.excel.read.processor;
exports org.apache.fesod.excel.support;
exports org.apache.fesod.excel.util;
exports org.apache.fesod.excel.write;
exports org.apache.fesod.excel.write.builder;
exports org.apache.fesod.excel.write.executor;
exports org.apache.fesod.excel.write.handler;
exports org.apache.fesod.excel.write.handler.chain;
exports org.apache.fesod.excel.write.handler.context;
exports org.apache.fesod.excel.write.handler.impl;
exports org.apache.fesod.excel.write.merge;
exports org.apache.fesod.excel.write.metadata;
exports org.apache.fesod.excel.write.metadata.fill;
exports org.apache.fesod.excel.write.metadata.holder;
exports org.apache.fesod.excel.write.metadata.style;
exports org.apache.fesod.excel.write.property;
exports org.apache.fesod.excel.write.style;
exports org.apache.fesod.excel.write.style.column;
exports org.apache.fesod.excel.write.style.row;
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.fesod.excel.module;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.JRE;

/**
* Placeholder to keep Java 8 test compilation green. The real module descriptor test
* (requiring Java 9+) lives under src/test/java9 with class name {@code ModuleDefinitionTest}.
* Disabled for all JRE >= 9 via @DisabledForJreRange to remain future-proof.
*/
@DisabledForJreRange(min = JRE.JAVA_9)
class ModuleDefinitionTestPlaceholder {

@Test
void noop() {
// Intentionally empty.
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,26 +21,31 @@

import java.io.File;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.apache.commons.collections4.CollectionUtils;

public class TestFileUtil {

public static InputStream getResourcesFileInputStream(String fileName) {
return Thread.currentThread().getContextClassLoader().getResourceAsStream("" + fileName);
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
return contextClassLoader == null ? null : contextClassLoader.getResourceAsStream(fileName);
}

public static String getPath() {
returnTestFileUtil.class.getResource("/").getPath();
returnresolveRootPath();
}

public static TestPathBuild pathBuild() {
return new TestPathBuild();
}

public static File createNewFile(String pathName) {
File file =new File(getPath() +pathName);
File file =pathFromRoot(pathName).toFile();
if (file.exists()) {
file.delete();
} else {
Expand All@@ -52,7 +57,7 @@ public static File createNewFile(String pathName) {
}

public static File readFile(String pathName) {
returnnew File(getPath() +pathName);
returnpathFromRoot(pathName).toFile();
}

public static File readUserHomeFile(String pathName) {
Expand All@@ -75,19 +80,71 @@ public TestPathBuild sub(String dirOrFile) {
}

public String getPath() {
String rootPath = resolveRootPath();
if (CollectionUtils.isEmpty(subPath)) {
returnTestFileUtil.class.getResource("/").getPath();
returnrootPath;
}
if (subPath.size() == 1) {
returnTestFileUtil.class.getResource("/").getPath() + subPath.get(0);
returnrootPath + subPath.get(0);
}
StringBuilder path =
new StringBuilder(TestFileUtil.class.getResource("/").getPath());
StringBuilder path = new StringBuilder(rootPath);
path.append(subPath.get(0));
for (int i = 1; i < subPath.size(); i++) {
path.append(File.separator).append(subPath.get(i));
}
return path.toString();
}
}

private static String resolveRootPath() {
Path codeSourceLocation = resolveFromCodeSource();
if (codeSourceLocation != null) {
return appendSeparator(codeSourceLocation.toString());
}

URL resource = null;
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
if (contextClassLoader != null) {
resource = contextClassLoader.getResource("");
}
if (resource == null) {
resource = TestFileUtil.class.getResource("/");
}
URL finalResource = Objects.requireNonNull(resource, "Unable to locate test resources root");
String path = finalResource.getPath();
if ("file".equals(finalResource.getProtocol())) {
if (path.startsWith("file:")) {
path = path.substring("file:".length());
}
}
return appendSeparator(path);
}

private static Path pathFromRoot(String relativePath) {
return Paths.get(resolveRootPath(), relativePath);
}

private static Path resolveFromCodeSource() {
try {
if (TestFileUtil.class.getProtectionDomain() == null
|| TestFileUtil.class.getProtectionDomain().getCodeSource() == null) {
return null;
}
Path location = Paths.get(TestFileUtil.class
.getProtectionDomain()
.getCodeSource()
.getLocation()
.toURI());
if (!location.toFile().isDirectory()) {
return null;
}
return location;
} catch (Exception ex) {
return null;
}
}

private static String appendSeparator(String path) {
return path.endsWith(File.separator) ? path : path + File.separator;
}
}
Loading

[8]ページ先頭

©2009-2025 Movatter.jp