Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solving module conflicts with bundled jar #36

Merged
merged 10 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from 8 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
2 changes: 1 addition & 1 deletion demos/demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes>
<exclude>internal/**</exclude>
<exclude>example/app/internal/**</exclude>
</excludes>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1996, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1996, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package example.app.internal;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package example.app.internal;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package example.app.internal;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package example.app.internal;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package example.app.internal;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package example.app.internal;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1996, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1996, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1996, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1996, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1996, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down
19 changes: 19 additions & 0 deletions demos/demo/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

module example.app {
requires com.sun.mail;
}
43 changes: 43 additions & 0 deletions demos/demo/src/test/java/example/app/ModulesTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package example.app;

import static org.junit.Assert.assertEquals;

import java.util.Properties;

import org.junit.Test;

import com.sun.mail.util.MailStreamProvider;

import jakarta.mail.NoSuchProviderException;
import jakarta.mail.Session;
import jakarta.mail.util.StreamProvider;

public class ModulesTest {

// With org.eclipse.angus:angus-mail
@Test
public void test() throws NoSuchProviderException, ClassNotFoundException {
Session session = Session.getDefaultInstance(new Properties());
StreamProvider provider = session.getStreamProvider();
assertEquals(MailStreamProvider.class, provider.getClass());
Class.forName("com.sun.mail.imap.IMAPProvider");
Class.forName("com.sun.mail.pop3.POP3Provider");
Class.forName("com.sun.mail.smtp.SMTPProvider");
}
}
3 changes: 2 additions & 1 deletion demos/logging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
<dependencies>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-mail</artifactId>
<artifactId>jakarta.mail</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 2009, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2019 Jason Mehrens. All Rights Reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -284,7 +285,7 @@ private OutputStream wrap(OutputStream out) {
assert out != null;
Class<?> k;
try {
k = Class.forName("NewlineOutputStream");
k = Class.forName("example.app.NewlineOutputStream");
if (OutputStream.class.isAssignableFrom(k)) {
Constructor<?> c = k.getConstructor(OutputStream.class);
return (OutputStream) c.newInstance(out);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 2009, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2018 Jason Mehrens. All Rights Reserved.
*
* This program and the accompanying materials are made available under the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package example.app;
/*
* Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2018 Jason Mehrens. All Rights Reserved.
*
* This program and the accompanying materials are made available under the
Expand Down
21 changes: 21 additions & 0 deletions demos/logging/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

module example.app {
requires jakarta.mail;
requires java.management;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requires java.logging too?

Copy link
Member Author

@jbescos jbescos Oct 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should because there is a reference to that in one class. But this should throw a compilation error and it is not happening. What could be the reason of this missing error?.

Copy link
Contributor

@jmehrens jmehrens Oct 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it works because jakarta.mail requires logging too. As in: requires transitive java.logging; is present in other module info files that is being required in this one.

So I think this is non-issue.

requires java.logging;
}
42 changes: 42 additions & 0 deletions demos/logging/src/test/java/example/app/ModulesTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package example.app;

import static org.junit.Assert.assertEquals;

import java.util.Properties;

import org.junit.Test;

import com.sun.mail.util.MailStreamProvider;

import jakarta.mail.Session;
import jakarta.mail.util.StreamProvider;

public class ModulesTest {

// With org.eclipse.angus:jakarta.mail
@Test
public void test() throws Exception {
Session session = Session.getDefaultInstance(new Properties());
StreamProvider provider = session.getStreamProvider();
assertEquals(MailStreamProvider.class, provider.getClass());
Class.forName("com.sun.mail.imap.IMAPProvider");
Class.forName("com.sun.mail.pop3.POP3Provider");
Class.forName("com.sun.mail.smtp.SMTPProvider");
}
}
8 changes: 8 additions & 0 deletions demos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,13 @@
<module>logging</module>
<module>outlook</module>
</modules>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

7 changes: 6 additions & 1 deletion demos/servlet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-mail</artifactId>
<artifactId>jakarta.mail</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>dsn</artifactId>
</dependency>
</dependencies>
</project>
Loading