Artifact definition (.idea/artifacts/*.xml) change when refresh gradle modules

已回答

Hi there,

 

I have a project with 3 gradle modules. In my project's artifact definition (.idea/artifacts/*.xml), whenever I refresh gradle modules, it changes the "name" property of element tag when I run the project on wildfly.

It changes from

<element id="archive" name="nts.uk.shr.com.jar">
<element id="module-output" name="nts.uk.shr.com_main" />
<element id="dir-copy" path="$PROJECT_DIR$/../UniversalK/nts.uk/uk.com/shr/nts.uk.shr.com/out/production/resources" />
</element>

to 

<element id="archive" name="uk.com.shr-nts.uk.shr.com.jar">
<element id="module-output" name="nts.uk.shr.com_main" />
<element id="dir-copy" path="$PROJECT_DIR$/../UniversalK/nts.uk/uk.com/shr/nts.uk.shr.com/out/production/resources" />
</element>

 

It makes the project unable to run because the name of the jars unmatch with the jars in libs.

I don't know why this happend. Any ideas?

 

This is my first post and English isn't my first language. Please forgive me if I make any mistake.

Thanks in advance.

1

What IDE version do you use?

Do you change artifact manually? Note that in case of Gradle (and Maven) based projects IDE automatically creates artifact configuration, including the names, based on build.gradle file configuration.

Does it help if you refresh the project and leave artifact name as "uk.com.shr-nts.uk.shr.com.jar" and rebuild the project?

0
Avatar
Permanently deleted user

I'm using version 2017.3.5

I do change the artifact definition xml manually. I know that IDE automatically creates artifact configuration, including the names, based on build.gradle file configuration. But the problem is that the project will run successfully if I change the artifact name from origin "uk.com.shr-nts.uk.shr.com.jar" to "nts.uk.shr.com.jar". 

0

Why do you need to change it?

0
Avatar
Permanently deleted user

Because if I leave artifact name as "uk.com.shr-nts.uk.shr.com.jar", rebuild and run the project, I will catch error:

Artifact Gradle : uk.com.com.web : nts.uk.com.web.war (exploded): Error during artifact deployment. See server log for details.
Artifact Gradle : uk.com.com.web : nts.uk.com.web.war (exploded): java.lang.Exception: {"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host.\"/nts.uk.com.web\"" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host.\"/nts.uk.com.web\": java.lang.RuntimeException: javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalArgumentException: Unknown Entity bean class: class nts.uk.shr.com.system.config.internal.CisctSystemConfig, please verify that this class has been marked with the @Entity annotation.
Caused by: java.lang.RuntimeException: javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalArgumentException: Unknown Entity bean class: class nts.uk.shr.com.system.config.internal.CisctSystemConfig, please verify that this class has been marked with the @Entity annotation.
Caused by: javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalArgumentException: Unknown Entity bean class: class nts.uk.shr.com.system.config.internal.CisctSystemConfig, please verify that this class has been marked with the @Entity annotation.
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Unknown Entity bean class: class nts.uk.shr.com.system.config.internal.CisctSystemConfig, please verify that this class has been marked with the @Entity annotation.
Caused by: java.lang.IllegalArgumentException: Unknown Entity bean class: class nts.uk.shr.com.system.config.internal.CisctSystemConfig, please verify that this class has been marked with the @Entity annotation."},"WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.deployment.default-server.default-host.\"/nts.uk.com.web\""],"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}
0
Avatar
Permanently deleted user

I really don't know how to fix it. Changing artifact name is just a temporary solution.

0

Do you deploy the artifact built by IDE (Build | Build Artifacts...) using IDE Run/Debug Configuration or you use Gradle? What JDK do you use for development?

 

If you want to configure artifacts manually you should create a new artifact (or duplicate existing one) and give it different name (other than is created automatically by IDE).

0
Avatar
Permanently deleted user

I deploy the artifact built by IDE using IDE Run/Debug Configuration in Java 1.8 JDK. 

 

Is it normal to use manually configured artifacts? Can I change build.gradle to change the way IDE create artifact?

 

 

0

>Is it normal to use manually configured artifacts?

Generally it is Ok, but you should remember that if you change the project structure (e.g. project dependencies) you will need then to make corresponding changes to such artifacts manually.

>Can I change build.gradle to change the way IDE create artifact?

Please consult Gradle's documentation, e.g. see https://stackoverflow.com/a/6774649/2000323.

1

请先登录再写评论。