Thank you for your answer.

Could anyone give any suggestion about the following?

I have my named module and weld-se-shaded as unnamed module.
In my module I have

module my.module {
    requires weld.se.shaded;
    exports com.foo;
}

#################################
package com.foo;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;

@ApplicationScoped
public class NewClass {

    @Inject
    private NewBean bean;

    public void doIt() {
        bean.doIt();
    }

}

#################################
package com.foo;

import javax.enterprise.context.Dependent;

@Dependent
public class NewBean {

    public void doIt() {
        System.out.println("I am doing it);
    }
}

And this is the result

Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup <clinit>
INFO: WELD-000900: 3.0.2 (2017-09-18 08:49)
Sep 18, 2017 2:33:12 PM org.jboss.weld.environment.deployment.discovery.ReflectionDiscoveryStrategy processAnnotatedDiscovery
INFO: WELD-ENV-000014: Falling back to Java Reflection for bean-discovery-mode="annotated" discovery. Add org.jboss:jandex to the classpath to speed-up startup.
Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup startContainer
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
Exception in thread "main" java.lang.reflect.InaccessibleObjectException
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
    at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:590)
    at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:996)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:72)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:58)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:66)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createClassBeans(ConcurrentBeanDeployer.java:65)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:256)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:422)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.environment.se.Weld.initialize(Weld.java:789)
    at my.module/com.foo.NewMain.main(NewMain.java:47)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private com.foo.NewBean com.foo.NewClass.bean accessible: module my.module does not "opens com.foo" to module weld.se.shaded
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281)
    at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176)
    at java.base/java.lang.reflect.Field.setAccessible(Field.java:170)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.of(GetAccessibleCopyOfMember.java:38)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:44)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:26)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.injection.FieldInjectionPoint.<init>(FieldInjectionPoint.java:65)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.createFieldInjectionPoint(InjectionPointFactory.java:141)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.addFieldInjectionPoint(InjectionPointFactory.java:226)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.getFieldInjectionPoints(InjectionPointFactory.java:211)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.DefaultInjector.<init>(DefaultInjector.java:56)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.<init>(ResourceInjector.java:57)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.of(ResourceInjector.java:48)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.<init>(BeanInjectionTarget.java:63)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.createDefault(BeanInjectionTarget.java:47)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryImpl.java:139)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:88)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.<init>(ManagedBean.java:100)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.of(ManagedBean.java:80)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.AbstractBeanDeployer.createManagedBean(AbstractBeanDeployer.java:280)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:221)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:68)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:65)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
    at weld.se.shaded@3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
    at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)





Понедельник, 18 сентября 2017, 14:18 +03:00 от Matej Novotny <manovotn@redhat.com>:

Hi,

if you are in SE, you should only need 'weld-se-shaded' artifact (as a JAR).
As it is "shaded", it brings along all the other parts of Weld you might need.

Matej


----- Original Message -----
> From: "Alex Sviridov" <ooo_saturn7@mail.ru>
> To: "weld-dev" <weld-dev@lists.jboss.org>
> Sent: Monday, September 18, 2017 12:17:28 PM
> Subject: Re: [weld-dev] Weld and Java 9 JPMS
>
> Hi Matej
>
> I am just trying to make Weld work in Java 9 (JavaSE + JPMS).
>
> I use the following jars as automatic modules:
>
> weld-environment-common-3.0.2-SNAPSHOT.jar
> weld-se-core-3.0.2-SNAPSHOT.jar
> weld-se-shaded-3.0.2-SNAPSHOT.jar
> weld-spi-3.0.SP1.jar
> weld-core-impl-3.0.2-SNAPSHOT.jar
>
> Is this right configuration? Or should I add/remove something.
>
> Best regards, Alex
>
>
>
> Понедельник, 18 сентября 2017, 12:41 +03:00 от Matej Novotny
> <manovotn@redhat.com>:
>
> Uhm, is there anything blocking you from placing it where you would in Java
> 8?
> E.g. src/main/resources/META-INF?
>
> I don't think I have tried this combination (or I do not recall).
> From the top of my head I don't know any JDK 9 limitation which would forbid
> to use XML descriptors in this way.
> I might be a bit rusty though; been a while since I played with Java 9.
>
> Please do report back with how this works for you :)
> Matej
>
> ----- Original Message -----
> > From: "Alex Sviridov" < ooo_saturn7@mail.ru >
> > To: "Matej Novotny" < manovotn@redhat.com >
> > Sent: Monday, September 18, 2017 10:28:11 AM
> > Subject: Re[2]: [weld-dev] Weld and Java 9 JPMS
> >
> > Thank you for your answer. I will try. But where should I place beans.xml
> > to make Weld read it if I use Java SE+ JPMS?
> >
> > Best regards, Alex
> >
> >
> > >Понедельник, 18 сентября 2017, 8:10 +03:00 от Matej Novotny
> > >< manovotn@redhat.com >:
> > >
> > >Hi Alex
> > >
> > >Back there we did some tests with earlier versions of Java 9 and
> > >eliminated
> > >some crucial problems.
> > >I think it should be possible to take *existing* app and run it on Java 9.
> > >
> > >However, creating a whole new modular project might present some
> > >additional
> > >challenges.
> > >Weld itself is not modularized (since it needs to run on Java 8),
> > >therefore
> > >you would need to list some extra "requires" in module-info.java for Weld.
> > >You also need to have reflection access allowed (we need to instantiate
> > >proxies etc) but last time I checked, it was by default enabled in JDK 9
> > >wi
> > >th just warning showing up.
> > >Other than that, it might just work.
> > >
> > >To answer your other question - no, there is no tutorial, for there is no
> > >special difference between Weld and many other projects in regard to JDK
> > >9.
> > >
> > >Matej
> > >
> > >----- Original Message -----
> > >> From: "Alex Sviridov" < ooo_saturn7@mail.ru >
> > >> To: "weld-dev" < weld-dev@lists.jboss.org >
> > >> Sent: Sunday, September 17, 2017 3:25:49 PM
> > >> Subject: [weld-dev] Weld and Java 9 JPMS
> > >>
> > >> Hi all
> > >>
> > >> Could anyone provide information how weld works (if works) with Java 9
> > >> JPMS?
> > >> Is there any tutorial?
> > >>
> > >> Best regards, Alex
> > >>
> > >> _______________________________________________
> > >> weld-dev mailing list
> > >> weld-dev@lists.jboss.org
> > >> https://lists.jboss.org/mailman/listinfo/weld-dev
> >
> >
> > --
> > Alex Sviridov
> >
>
>
> --
> Alex Sviridov
>
> _______________________________________________
> weld-dev mailing list
> weld-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev


--
Alex Sviridov