Creating artifacts for several java architectures using Maven (nothing better than profiles)?

After reading about every post and question I can find, I’m at a dead end finding a better way than just using profiles to do the following.

I need to take the same set of modules and compile them for completely different architectures (J2ME vs J2SE), they need different dependencies for some libraries, and they need different source / target / debug settings at compile time.

Using profiles and classifiers, I can do this by running one profile, cleaning and running the assembly with another profile. Sorting results are classified. However, if you just change profiles and rebuild, it will not be cleaned on its own, it requires running maven multiple times against super-pom, and it will not allow you to include several profiles at the same time (and the resulting mess when you do this is pretty ugly).

Can I do something using the supplied artifacts and forcing the compilation steps and jar to run several times?

Javac options are really kickers: (using profiles for dependencies doesn't cause any problems)

for J2ME:
Source = 1.4
target = 1.4
-g: source

for debugging J2ME
Source = 1.4
TARGET = 1.4

J2SE
= 1,5
TARGET = 1,5

+3
1

Maven Compiler Plugin, . -

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <executions>
        <execution>
          <id>compile1</id>
          <phase>generate-resources</phase>
          <goals>
              <goal>compile</goal>
          </goals>
          <configuration>
                <verbose>true</verbose>
                <fork>true</fork>
                <executable><!-- path-to-javac --></executable>
                <compilerVersion>1.3</compilerVersion>
            </configuration>
       </execution>
       <execution>
          <id>compile1</id>
          <phase>generate-resources</phase>
          <goals>
              <goal>compile</goal>
          </goals>
          <configuration>
                <verbose>true</verbose>
                <fork>true</fork>
                <executable><!-- path-to-javac --></executable>
                <compilerVersion>1.3</compilerVersion>
            </configuration>
       </execution>
   </executions>
  </plugin>
+2

Source: https://habr.com/ru/post/1795634/


All Articles