Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] OpenAM problem: The import com.sun.identity cannot be resolved

Platform: Windows 9
	  Java JDK 1.8.0_172
          eclipse Oxygen 3a Release (4.7.3a)
          m2e 1.8.3.20180227-21
          maven 3.5.2 (the command line maven)

I have some code that uses this import (and the Debug class it imports)
in generated code:
 import com.sun.identity.shared.debug.Debug;

The project builds without issues with command line maven but fails in
the generated code, with the messages
 The import com.sun.identity cannot be resolved
and
 Debug cannot be resolved to a type

The code generation isn't generation, as such.  It is unpack of a maven
artifact:
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.forgerock.openam</groupId>
                                    <artifactId>openam-shared</artifactId>
                                    <version>12.0.0-1</version>
                                    <type>java-source</type>
                                    <outputDirectory>${project.build.directory}/generated-sources/</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                            <includes>**/BaseResourceName.java,**/BasePrefixResourceName.java,**/BaseURLResourceName.java
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

The top project POM of the project sets the code version to 1.7:
deliberate source):
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.0</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.4.1</version>
                </plugin>
            </plugins>
        </pluginManagement>

We have some legacy applications still using 1.7, so I have to assume
this is a deliberate decision.

I also have to assume that the use of dependency:unpack instead of a
regular maven dependency is a deliberate choice.

Without the "generated-resources" as a source folder, the eclipse
project won't build at all.

When I add "generated-resources" containing the unpacked dependency, as
a source folder in the imported maven project, the project builds except
for the error messages:
 The import com.sun.identity cannot be resolved
and
 Debug cannot be resolved to a type

I'm told that "com.sun.identity" was an unofficial API that was part of
some JREs (I've been unable to confirm this with google matches).

OpenAM was formerly the Sun project OpenSSO.  When OpenSSO was
discontinued by Sun, it was picked up by ForgeRock and changed into the
system OpenAM.

When I change the maven-compiler-plugin configuration from source and
target version 1.7 to version 1.8, the project builds in eclipse, but
may become unusable for current clients of the library.

Is there a way to make this project build in eclipse, while keeping the
Java version as 1.7?

Thanks!


- Steinar



Back to the top