Project
IntelliJ IDEA
Priority
Normal
Type
Bug
Fix versions
No Fix versions
State
Duplicate
Assignee
Alexander Doroshko
Subsystem
Flash/Flex
Affected versions
98.311
Fixed in build
No Fixed in build
  • Created by   Joa Ebert
    18 months ago (10 Nov 2010 13:40)
  • Updated by   Joa Ebert
    16 months ago (04 Jan 2011 16:15)
 
IDEA-61024 Flex namespace configuration files are deleted
3
Issue is visible to: All Users
  The issue is visible to the selected user group only
  1. I am using FlexMojos 4.x
  2. I do a complete build with FlexMojos to generate required configuration files
  3. I open the super POM with IntelliJ
  4. I set the Flex SDK of my first module to the one I really want to use (IntelliJ does not pickup the right version for some reason)
  5. I build the project, which seems to work only with built-in compiler and not compc/mxmlc or FCSH option

Now the problem arises. For some reason IntelliJ seems to delete configuration files that are created by Maven. Specifically maven creates ../target/classes/configuration/*.xml and all those files are deleted. However they are referenced by the .../target/${artifactId}-${version}-config.xml file as namespace manifests.

To fix this one has to recompile everything again with Maven to generated the configuration files. The only problem is that IntelliJ will delete them again and it seems quite random.
Comments (20)
 
History
 
Linked Issues (?)
 
Alexander Doroshko
  Alexander Doroshko
10 Nov 2010 14:20
18 months ago
First of all, currently IntelliJ IDEA doesn't support Flexmojos 4 fully because target/${artifactId}-${version}-configs.xml files which are generated by Flexmojos build are not 100% correct and complete. IDEA will have own lightweight goal to generate correct Flex compiler configuration file, hopefully in 10.0.1 update release. So currently it is usually impossible to compile Flexmojos 4 project in IntelliJ IDEA, but code highlighting is usually ok.

Building the project using any of 3 compilers should be performed in the same way, so it is rather strange if only one of 3 works. What are error messages with compc/mxmlc or fcsh?

If IntelliJ does not pickup the right version of Flex SDK - it is a bug that needs to be fixed. Please provide details about how Flex SDK is set in pom and what IDEA actually imports.

About deletion of ./target/classes/configuration/**.** files - first of all make sure that File | Settings | Compiler | Clear output directory on rebuild is switched off.
Joa Ebert
  Joa Ebert
10 Nov 2010 17:33
18 months ago
It works now very well after I removed all dependencies to Spark components etc. That way the namespaces and manifest files are no longer required. In fact IntelliJ does work but you have to do some weird tricks. For instance, before importing the project for the first time, we run FlexMojos 3.x once with a goal that fails, simply to get the artifacts in the local repo. Then IntelliJ is able to import and compile a project. There are some more of such "magic" tricks but now we have a setup that finally seems to be stable and allows us to use best of both worlds.

By the way: What exactly is FlexMojos doing wrong? Maybe something that can be fixed quite easy since it is an open source project and more convenient than waiting for you to write a special IntelliJ goal.
Alexander Doroshko
  Alexander Doroshko
10 Nov 2010 18:15
18 months ago
Anyway, can you confirm that files deletion was caused by 'Clear output directory on rebuild' option? Because if files deletion happened by any other reason we need to check and fix it.

And different behavior of different compilers. We need to know if the issue is really present :)

And incorrect Flexmojos SDK version import. We used Flexmojos 4 a bit but haven't seen this issue.

Flexmojos is doing -configs.xml file wrong because it uses standard option -dump-config of Adobe's Flex compiler. It is rather buggy and doesn't dump some options or does it incorrectly. Actually we have already written an ultra-fast goal to generate correct config file. But we can't integrate it in IDEA currently because IDEA doesn't support Maven 3 fully. This will be done in 10.0.1 I hope.
Vladimir Krivosheev
  Vladimir Krivosheev
10 Nov 2010 19:01
18 months ago
Maybe something that can be fixed quite easy since it is an open source project

already :) flexmojos 4 has extension point and new mojo — configurator.

Due to "IDEA doesn't support Maven 3 fully", you can use standard maven way (require flexmojos 4.0-SNAPSHOT, after https://github.com/Flexmojos/flexmojos/commit/81c3cd45bf5e4226946ae09f717be81cc1a56d6f ):

Add dependency to flexmojos-maven-plugin dependencies:
<dependency>
  <groupId>com.intellij.flex.maven</groupId>
  <artifactId>flexmojos-idea-configurator</artifactId>
  <version>1.0.2</version>
</dependency>


And param to configuration:
<configurator>com.intellij.flex.maven.IdeaConfigurator</configurator>


Example:
<plugin>
  <groupId>org.sonatype.flexmojos</groupId>
  <artifactId>flexmojos-maven-plugin</artifactId>
  <version>4.0-SNAPSHOT</version>
  <extensions>true</extensions>
  <dependencies>
    <dependency>
      <groupId>com.adobe.flex</groupId>
      <artifactId>compiler</artifactId>
      <version>${flex.sdk.version}</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.intellij.flex.maven</groupId>
      <artifactId>flexmojos-idea-configurator</artifactId>
      <version>1.0.2</version>
    </dependency>
  </dependencies>

  <configuration>
    <configurator>com.intellij.flex.maven.IdeaConfigurator</configurator>
  </configuration>
</plugin>


Add repo:
<repositories>
  <repository>
    <id>flyti</id>
    <url>http://repository.flyti.org/</url>
  </repository>
</repositories>
<pluginRepositories>
<pluginRepository>
  <id>flyti</id>
  <url>http://repository.flyti.org/</url>
</pluginRepository>
</pluginRepositories>



Run: mvn flexmojos:configurator (multimodule project is not supported). Specify target/*-config-report.xml as custom compiler configuration file.
Joa Ebert
  Joa Ebert
10 Nov 2010 19:29
18 months ago
By the way: "Clear output direcotry" was checked, but it looks like IntelliJ did not clear the directory for nearly half the day. My colleague could work and now he came back to me with the same problem. The files were missing and we figured that he had the "Clear output" on build checked but it was checked for the whole day and he did a lot of builds today. Now we removed it :)
Alexander Doroshko
  Alexander Doroshko
10 Nov 2010 19:45
18 months ago
Output directories are usually not cleared when you Make the project. Only when you do Build | Rebuild Project. But if sometimes goes wrong (like caches are corrupted) IDEA automatically switches from Make to Rebuild and thus clears output directories.
Joa Ebert
  Joa Ebert
10 Nov 2010 19:46
18 months ago
That explains the issue.
Alexander Doroshko
  Alexander Doroshko
10 Nov 2010 19:49
18 months ago
Ok, closing the request. Still waiting for info if there's a bug in any of 3 compilers or incorrect Flexmojos SDK version when importing :)
Related Changes
Resolved Date
18 months ago (10 Nov 2010 19:50)
State
SubmittedDuplicate
Assignee
Alexander Doroshko (alexander.doroshko)Alexander Doroshko
Subsystem
<lost change>Flash/Flex
Affected versions
98.311
Affected version
<lost change>
Joa Ebert
  Joa Ebert
10 Nov 2010 19:52
18 months ago
Wrong SDK version is true. I have set it to 4.1.0.16076, you show me in IntelliJ that compiler-4.1.0.15646 is used.
Joa Ebert
  Joa Ebert
10 Nov 2010 19:54
18 months ago
Same configuration, using built-in compiler shell works, using compc/mxmlc fails. But I can explain why.
Joa Ebert
  Joa Ebert
10 Nov 2010 19:55
18 months ago
FCSH works as well. But it fails because built-in compiler shell uses the same Flex SDK that the first module has configured for all following modules. This is probably a bug, but cool for use, because I only have to set the SDK to 4.1.0.16076 instead of 4.1.0.15646 for one module instead of 160 every time I reimport the Maven project. However the mxmlc/compc solution uses the SDK specified for each module individually. So generally speaking it works, but it behaves different than built-in.
Alexander Doroshko
  Alexander Doroshko
10 Nov 2010 20:10
18 months ago
Actually fcsh uses SDK from one of the modules as well as built-in compiler shell. I think that's ok in 99.9% cases as people usually use one version of SDK for the whole project.
What is strange is incorrectly picked version. So you manually fix it but next reimport changes it to incorrect again, right? Please paste a snippet how compiler version is set. It is probably specified by a property that is managed by profile or whatever...
Joa Ebert
  Joa Ebert
10 Nov 2010 20:22
18 months ago
No it is simple <properties><flex.version>4.1.0.16076</flex.version>[...]</properties> and I have a dependency to com.adobe.flex.framework:flex:${flex.version}:swc and com.adobe.flex.framework:playerglobal:${flex.version}:swc:10.1 but that is it.
Alexander Doroshko
  Alexander Doroshko
10 Nov 2010 20:29
18 months ago
SDK version is taken not from version of com.adobe.flex.framework:flex but from version of com.adobe.flex:compiler from dependencies of flexmojos plugin and by default takes "4.1.0.15646". As far as I know flexmojos requires versions of compiler and framework to be the same, isn't it? So what is in your plugin dependencies section? Or may be defaults changed in flexmojos recently?
Joa Ebert
  Joa Ebert
10 Nov 2010 20:36
18 months ago
It is not set. There is no plugin dependency besides com.adobe.flex.compiler.flex-fontkit:$flex.version
Alexander Doroshko
  Alexander Doroshko
03 Dec 2010 22:51
17 months ago
Flexmojos gives an error if com.adobe.flex:compiler version from dependencies of plugin is not equal to com.adobe.flex.framework:flex-framework version from project dependencies:
[ERROR] Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:4.0-beta-3:compile-swf (default-compile-swf) on project flexmojos4_sample: Execution default-compile-swf of goal org.sonatype.flexmojos:flexmojos-maven-plugin:4.0-beta-3:compile-swf failed: Flex compiler and flex framework versions doesn't match. Compiler: '4.5.0.17855' - Framework: '4.0.0.14159'.
[ERROR] You can use 'ignoreVersionIssues' to disable this check.  Please refer to Flexmojos maven doc.
[ERROR] If you prefer fixing it instead of ignoring, take a look at: https://docs.sonatype.org/display/FLEXMOJOS/How+to+set+Flex+SDK+version

So you need either ignoreVersionIssues option or explicit plugin dependency or Flexmojos version that has 4.1.0.16076 version of compiler by default. The latest SNAPSHOT by default has 4.5.0.18623
Joa Ebert
  Joa Ebert
13 Dec 2010 15:14
17 months ago
Alexander: Are multi module projects now supported?
Vladimir Krivosheev
  Vladimir Krivosheev
13 Dec 2010 15:35
17 months ago
You are about configuration mojo? Vote for https://issues.sonatype.org/browse/FLEXMOJOS-374
Vladimir Krivosheev
  Vladimir Krivosheev
13 Dec 2010 15:51
17 months ago
flexmojos-idea-configurator — actual version 1.0.3 (for flexmojos 4.0-beta-4 and maven 3.0.1), "Specify target/*-config-report.xml as custom compiler configuration file." is not needed (i.e. skip this step).
Joa Ebert
  Joa Ebert
04 Jan 2011 16:15
16 months ago
Vladimir, Alexander: I am still getting the same issue even after all the configuration regarding a specific compiler. What about the configuration mojo. Any steps forward? :)