question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Java source files are not copied when "optimizationLevel" is set to "SIMPLE"

See original GitHub issue

Hi:

When you use the plug-in for Maven and set the optimizationLevel option to SIMPLE, the plug-in does not copy the Java source files to the target directory; it only copies the source maps. These are the most relevant options of my configuration:

...
<sourceMapsGenerated>true</sourceMapsGenerated>
<sourceFilesCopied>true</sourceFilesCopied>
<optimizationLevel>SIMPLE</optimizationLevel>

If you set optimizationLevel to ADVANCED or FULL, though, the source files are effectively copied there.

This happens in version 0.6.1 and also 0.7.0-dev-1105.

The only workaround that has came to my mind is to compile first in ADVANCE level and then in SIMPLE level. But it’s tiring when you need to do multiple clean-then-build actions.

Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
konsoletypercommented, Jun 2, 2020

Ok, but writing a documentation requires some time and efforts from my side which I don’t have. So in brief you need teavm-cli artifact. To build it, you need to enable with-cli Maven profile. CLI module is located at tools/cli directory. Also, you can download this artifact from bintray (for example, current latest one is https://bintray.com/konsoletyper/teavm/download_file?file_path=org%2Fteavm%2Fteavm-cli%2F0.7.0-dev-1105%2Fteavm-cli-0.7.0-dev-1105.jar).

Run

java -cp teavm-cli-0.7.0-dev-1105.jar org.teavm.cli.TeaVMDevServerRunner

from command line and you’ll get some help.

You’ll need to specify following options:

java -cp teavm-cli-0.7.0-dev-1105.jar org.teavm.cli.TeaVMDevServerRunner \
  package.name.MainClassName \
  -p classpath-element1 \
  -p classpath-element2 \
  -s source-element1 \
  -s source-element2 \
  --deobfuscate-stack \
  --indicator

And dev server will serve generated Javascript at http://localhost:9090/classes.js. Classpath elements are either directories (path/to/module/target/classes or jar files). Each time .class files are updated, TeaVM will pick these changes and rebuild Javascript.

1reaction
konsoletypercommented, Jun 1, 2020

I fixed the issue. However, I see that your are trying to use Maven for development cycle, which is inefficient. I’m going to remove incremental mode from Maven build at all. You can try to use dev server available on IDEA plugin (which has really efficient incremental compilation and performs deobfuscation of stack traces and allows debugging right in IDEA) or if IDEA is not an option for you, ask me and I provide further instructions to setup CLI version of dev server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

4 Ways to Copy File in Java | DigitalOcean
Java copy file is a very common operation. But java.io.File class doesn't have any shortcut method to copy a file from source to...
Read more >
IntelliJ IDEA - how to copy .java file as a resource?
java files are in a source tree (in order to be copied as resources), they are automatically compiled. I do not want to...
Read more >
Copying a File or Directory - The Java™ Tutorials
Directories can be copied. However, files inside the directory are not copied, so the new directory is empty even when the original directory...
Read more >
IC45411: WHEN COPYING .JAVA FILES IN ECLIPSE ... - IBM
java file from one folder to another, using copy/paste, the source file is checked out. This is only the case with .java files....
Read more >
RTI Code Generator User's Manual
-noCopyable. Forces Code Generator to put 'copy' logic into the corresponding TypeSupport class, rather than the type itself. This option is only used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found